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 August 2004|
|PDF File Size:||11.22 Mb|
|ePub File Size:||10.64 Mb|
|Price:||Free* [*Free Regsitration Required]|
See the minitutorial on the token manager for more details.
JavaCC™: JJTree Reference Documentation
If neither the lookahead limit nor the syntactic lookahead has been provided which means the semantic lookahead is providedthe lookahead limit defaults to 0. This is described later.
So the parser needs to look at the next two symbols. After this is a list of grammar productions. The number of tokens to look ahead before making a decision at a choice point during parsing.
The name of the non-terminal is the name of the method, and the parameters and return value declared are the means to pass values up and down the parse tree. You can insert calls to the following methods to control this tracing activity:.
This assignment is not performed during lookahead evaluation. The default for this is true.
Unlike the other two lookahead constraints that are ignored at non-choice points, semantic lookahead is always evaluated. An expansion unit can be a parenthesized set of one or more documentatin choices. For sophisticated, or bizarre, parsing, sometimes semantic lookahead is needed. For example, it might store the node’s first token in the node.
A match for this kind of complex regular expression unit is any character that is allowed by the character list. In ddocumentation real compiler, you don’t dump a main method into the parser. If a local lookahead specification has been provided, but not all lookahead constraints have documetation included, then the missing ones are assigned default values as follows: This can be useful when implementing preorder and postorder traversals. Then any legal match of the unit is zero or more repetitions of a legal match of the parenthesized set of choices.
Grammar files are preprocessed documentaion Unicode escapes just as Java files are i.
JavaCC API Documentation
The set of legal parses allowed by an expansion choice is a legal parse of any one of the contained expansions. Instead all access must be made through the parser interface.
And you’d define the tree classes in their own files. This behavior can be modified so that some nonterminals do not have nodes generated, or so that a node is generated for a part of a production’s expansion.
They are both called with the current node as a parameter. The token manager creates a Token object for each match of such a regular expression and returns it to the parser. By default, Java Unicode escapes are not processed. If this option is set to true, then the parser is generated to accept tokens from any token manager of type “TokenManager” – this interface is generated into the generated parser directory.
Detailed JavaCC documentation is organized as a set of minitutorialseach on a separate topic. If the local lookahead specification is not at a choice point, then the syntactic lookahead is ignored – hence a default value is not relevant. This essentially implements “infinite lookahead” – namely, look ahead as many navacc as necessary to match the syntactic lookahead that has been provided.
This option setting controls lookahead ambiguity checking performed by JavaCC. The default action is to generate the token manager file “MyParserTokenManager.
You can further customize the generated tree:. You can use methods documentaion this member to manipulate javaccc node stack. The only reason to set this option to false is to save some time during parser generation when you fix problems in the parser part of the grammar file and leave the lexical specifications untouched.
See the minitutorial on the token manager for more details of special token handling. These classes, methods, and variables are typically used from the actions that are embedded in a Javacd grammar.
The other regular expression has to be labeled so that it can be referenced. There are three different kinds of lookahead constraints – a lookahead limit the integer literala syntactic lookahead the expansion choicesand a semantic lookahead the expression within braces.
Setting it to false causes errors due to parse errors to be reported in somewhat less detail. The methods must have the following signatures: The generated token manager receives characters from this stream reader.
Sometimes no number of lookahead tokens is sufficient for the parser. The typical LL 1 grammar for this is:.
For example, public static Node MyNode. The declarations in this part are visible to all Java code in actions in the BNF expansions.