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):||19 November 2004|
|PDF File Size:||11.7 Mb|
|ePub File Size:||6.52 Mb|
|Price:||Free* [*Free Regsitration Required]|
User actions other than the final one can only access the children on the stack. There are two parts on the right hand side of an BNF production. The second part of the right hand side are the BNF expansions. Non-terminals may not be used in an expansion in a manner that introduces left-recursion. You might use this is in action like this: Parsing with respect to a non-terminal is achieved by calling the method corresponding to that non-terminal.
Hence identifiers, strings, characters, navacc.
JavaCC – The Java Parser Generator
In this example, an indefinite node P3 is begun, marking the stack, and then a P4 node, one or more P5 nodes and a P6 node are parsed.
Using the Default Character Stream Readers: A brief description of each kind of lookahead constraint is given below:.
This is generated into the method parsing the non-terminal at the appropriate documnetation. And if A and B have a common three token prefix, then JavaCC only tell you that you need to have a lookahead of 3 or more.
By default JJTree generates code to construct parse tree nodes for each nonterminal in the language. For example, public static Node MyNode.
Ready to jump in?
You’d make a nice jaavacc called parse perhaps, and call that from your own code. You can also use an expression involving jjtThis on the left hand side of an expansion reference.
The final user action within a conditional node scope can determine whether the node was created or not by calling the nodeCreated method. This is then followed by a list of regular expression specifications that describe in more detail the lexical entities of this regular expression production.
JavaCC checks this for you. JJTree automatically generates a file called parser TreeConstants. InSun Microsystems released a parser generator called Jack. The final user action in a node scope is different from all the others. Unlike yacc, however, JavaCC generates top-down parsers. A scope is the expansion unit immediately preceding the node decoration.
JJTree is distributed with some simple examples containing a grammar that parses arithmetic expressions.
A character list is a list of character descriptors separated by commas within square brackets. A match for a complex regular expression is a concatenation of matches to the complex regular expression units. The parsing functions look rather like the EBNF for a grammar: A conditional node descriptor expression can be any boolean expression.
A character list is a way of defining a set of characters. For convenience, these methods are available even when you build parsers without the debug options. There are four kinds: The String parameter to dump is used as padding to indicate the tree hierarchy. As will be seen later, non-terminals on the right hand sides of productions are written as method calls, so the passing of values documentqtion and down the tree are done using exactly the same paradigm as method call and return.
JJTree maintains some state in the parser object itself.
The first and last token for each node will be set up automatically jafacc the parser is run. Detailed JavaCC documentation is organized as a set of minitutorialseach on a separate topic. An expansion unit can be a regular expression. Some checks such as detection of left recursion, detection of ambiguity, and bad usage of empty expansions may be suppressed for faster parser generation by setting this option to false.