DOCUMENTATION. CONTACT. The Java Parser Generator. Java Compiler Compiler™ (JavaCC™) is the most popular parser generator for use with Java™ . By following the links from this page you should be able to obtain all necessary documentation on JavaCC. In addition to these links there is also some useful. This web page is a comprehensive list of all classes, methods, and variables available for use by a JavaCC [tm] user. These classes, methods, and variables are.
|Published (Last):||8 October 2008|
|PDF File Size:||10.12 Mb|
|ePub File Size:||14.55 Mb|
|Price:||Free* [*Free Regsitration Required]|
As will be seen later, non-terminals on the right hand sides of productions are written as method calls, so the passing of values up and down the tree are done using exactly the same paradigm documentatikn method call and return.
JJTree currently cannot detect whether exceptions are thrown from user actions within a node scope. Parsing functions can take documentqtion parameters, return results, and invoke blocks of arbitrary Java code. Sometimes it is useful to gradually build up documentatioh token to be passed on to the parser. The set of legal parses allowed by an expansion choice is a legal parse of any one of the contained expansions.
On a successful parse, this method returns normally. One parser generator for Java is called JavaCC. Then a legal match of the unit is either the empty string or any legal match of the nested choices. The name of the visitor interface is constructed by appending Visitor to the name of the parser. Sometimes no number of lookahead tokens is sufficient for the parser.
This method can initialize fields in the node or call its methods. Explicitly setting this option allows the user to separate the parser from the tree files. An expansion unit can be a non-terminal the last choice in the syntax above. The main reason for having a parser in a token manager is using some of its logic in lexical actions.
This instructs the generated parser on how to make choices at choice points. A definite node is constructed with a specific number of children. An exception thrown by an expansion within a node scope that is not caught within the node scope is caught by JJTree itself.
The methods must have the following signatures:. Here, returntype and parameters are what were specified in the JavaCC input file in the definition of NT where NT occurred on the left-hand side.
Then any legal parse of the expansion unit is one or more repetitions of a legal parse of the parenthesized set of expansion choices. The smaller this number, the faster the parser.
JavaCC™: JJTree Reference Documentation
This returns true if the node’s condition was satisfied and the node was created and pushed on the node stack, and false otherwise. See the JavaCC documentation for details. documenttaion
In simple mode each parse tree node is of concrete type SimpleNode; in multi mode the type of the parse tree node is derived from the name of the node. JJTree operates in one of two modes, simple and multi for want of better terms. The signature of this method is: The only reason to set this option to false is to improve performance.
This is the number of tokens considered in checking choices of the form “A B This is then followed by a list of regular expression specifications that describe in more detail the lexical entities of this regular expression production.
You can use methods in this member to manipulate the node stack. You can give it a different name with the following syntax:. The default for this is AST.
While you can say pretty much what you want with these productions, JavaCC simply considers it a black box that somehow performs its parsing task. You can use this class as a template or superclass for your node implementations, or you can modify it to suit. The children are numbered from zero, left documentatikn right.
JavaCC – The Java Parser Generator
The first kind of regular expression is a string literal. JJTree keeps its state in a parser class field called jjtree.
We recommend the following step-by-step process to learning JavaCC: This means that syntactic lookahead is not performed it passes triviallyand only semantic lookahead is performed. This is the number of tokens considered in checking all other kinds of choices i.
This is a string option whose default value is “”, meaning that Tokens will be created by calling Token. A regular expression production is used to define lexical entities that get processed by the generated token manager.
If the compilation unit includes a package declaration, this is included in all the generated files. From Wikipedia, the free encyclopedia.
The other regular expression has to be labeled so that it can be referenced. A successful parse of the non-terminal causes the parameters documentaton in the method call to be operated on and a value returned in case the non-terminal was not declared to be of type “void”.
Option names are not case-sensitive.