javacc-7.0.4.examples.JavaGrammars.README Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacc Show documentation
Show all versions of javacc Show documentation
JavaCC modified by Tencent blueking.
The newest version!
/* Copyright (c) 2006, Sun Microsystems, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Sun Microsystems, Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*/
This directory contains a bunch of Java grammars:
Java1.0.2.jj:
This is our most thoroughly tested Java grammar. It is a
faithful rendering of the language syntax as specified by the
Java Language Specification by Gosling, Joy, and Steele.
Java.1.0.2LS.jj:
This is a minor modification of Java1.0.2.jj which uses
lexical states to express the comment tokens. While this is a
cleaner grammar, it has not been tested as thoroughly as the
previous grammar. Over time, we will make this grammar our
primary grammar and delete Java1.0.2.jj.
Java1.1.jj:
This is the grammar that includes the Java 1.1 language
extensions. It is based on the Java Language Specification
by Gosling, Joy, and Steele augmented by the inner class
document released with JDK 1.1.
Java1.1noLA.jj:
Same as Java1.1.jj, but all explicit syntactic lookaheads
are replaced by semantic lookaheads to minimize the space
requirements of the generated parser. To do the same kind
of optimization for your grammar, please see file OPTIMIZING
in this directory.
To build a parser from a .jj file, simply type:
"javacc "
in this directory. The files that comprise the Java parser are
generated into this directory.
Compile these files using "javac".
JavaParser.java contains a main program that takes input from either
the standard input or from the file specified as the argument to
"java". i.e., A Java program can be parser in either of the following
ways:
java JavaParser < javafile
java JavaParser javafile