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):||10 August 2016|
|PDF File Size:||6.84 Mb|
|ePub File Size:||1.97 Mb|
|Price:||Free* [*Free Regsitration Required]|
White space in the grammar files also follows the same conventions as for the Java programming language. The Name construct acts as a postfix operator, and its scope is the immediately preceding expansion unit. The default action is to generate the parser file “MyParser. The lexical state list describes the set of lexical states for which the corresponding regular expression production applies.
The signature of this method is: When set to true, the generated token manager will include a field called parser that references the instantiating parser instance of type MyParser in the above example. If this was not provided, the parser uses the expansion to be selected during lookahead determination.
The children are numbered from zero, left to right. The regular expressions in this regular expression production describe tokens in the grammar.
This option is used to obtain debugging information from the generated parser. Setting it to false causes errors due to parse errors to be reported in somewhat less detail. You can further customize the generated tree: There are four kinds: For each non-terminal NT in the input grammar file, the following method is generated into the parser class:. A complex regular expression unit can be a character list.
Each character descriptor describes a single character or a range of characters see character descriptor belowand this is added to the set of characters of the character list. When the code within it executes, the node’s children have already been popped from the stack and added to the node, which has itself been pushed onto the stack.
JavaCC – Wikipedia
An expansion is written as a sequence of expansion units. Following this is a description of what kind of regular expression production this is see below for what this means. The names of constants are derived by prepending JJT to the uppercase names of nodes, with dot documentayion “. The only reason to set this option to false is to improve performance. There are four kinds of productions in JavaCC.
JavaCC™: Grammar Files
JJTree maintains some state in the parser object itself. When this occurs, any nodes that have been pushed on to the node stack within the node scope are popped and thrown dockmentation. The default action is to generate support classes such as Token. If the parser is non-static, you may use the “new” dkcumentation to construct as many parsers as you wish.
We recommend the following step-by-step process to learning JavaCC: You specify a language’s lexical and syntactic cocumentation in a JJ file, then run javacc on the JJ file.
However, the token manager’s behavior is. Hence it is possible that the Java compiler will find errors in your actions that have been processed by JavaCC. When a regular expression is matched, it creates an object of type Token.
A brief description of each kind of lookahead constraint is given below: This walks over the node’s children in turn, asking them to accept the visitor. The default action is to generate a token manager that works on the specified grammar tokens. This option is used to obtain debugging information from the generated token manager. Option names are not case-sensitive.
Dicumentation generated parser file contains everything in the compilation unit and, in addition, contains the generated parser code that is included at the end of the parser class. A match for a complex regular expression is a concatenation of matches to the complex regular expression units. This parameter identifies the kind of node and is especially useful in simple mode.
This is located under the examples directory in a directory called JJTreeExamples. This provides the complete syntax of the grammar file along with a detailed description of these constructs.
This facilitates some performance improvements. This identifier is implicitly declared to be of the correct type for the node, so any fields and methods that the node has can be easily accessed.
Typically, this option is set to false when you wish to generate only the token manager and use it without the associated parser. You can insert calls to the following methods to control this tracing activity:.