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):||23 December 2005|
|PDF File Size:||6.82 Mb|
|ePub File Size:||1.72 Mb|
|Price:||Free* [*Free Regsitration Required]|
This includes the syntax for comments. The Life Cycle of a Node A node goes through a well determined sequence of steps as it is built. The default for this is true.
Then a legal parse of the expansion unit is either the empty token sequence or any legal parse of the nested expansion choices. Tracking Tokens It is often useful to keep track of each node’s first and last token so that input can be easily reproduced again. The final user action within a conditional node scope can determine whether the node was created or not by calling the nodeCreated method.
This document describes how you can customize error messages and also recover from errors during parsing. Unlike yacc, there is no single start symbol in JavaCC – one can parse with respect to any non-terminal in the grammar. The following minitutorials are currently available: If the expression evaluates to true, the parsing continues normally. Option names are not case-sensitive. Click here to get to the JJDoc documentation.
There is also an interpreter for a simple language that uses JJTree to build the program representation.
On a successful parse, this method returns normally. This takes more time to do than the choice checking, and hence the default value is set to 1 rather than 2. The indefinite node shorthand 1 can lead to ambiguities in the JJTree source when it is followed by a parenthesized expansion. This block is executed whenever the parsing process crosses this point successfully.
An exception thrown by an expansion within a node scope that is not caught within the node scope is caught by JJTree itself.
Sometimes it is useful to gradually build up a token to be passed on to the parser. The second part of the right hand side are the BNF expansions.
JavaCC Grammar Files
See the JavaCC documentation for details. JavaCC Java Compiler Compiler is an open-source parser generator and lexical analyzer generator written in the Java programming language. It encapsulates all this state with an object that can be referred to via the jjtree field. They have not yet been added to the node, so they aren’t available via the node’s methods.
The generated token manager receives characters from this stream reader. You might use this is in action like this:. For large grammars such as the Java grammar, increasing this number any further causes the checking to take too much time.
It indicates that child nodes can now be added to it. A complex regular expression unit can be a reference to another regular expression.
JavaCC™: Documentation Index
This allows only one parser object to be present, but it improves the documentstion of the parser. This is useful for writing grammars for languages such as HTML. Retrieved from ” https: JJTree provides some basic support for the visitor design pattern.
If this option is set to dlcumentation, then the parser is generated to accept tokens from any token manager of type “TokenManager” – this interface is generated into the generated parser directory.
Hence you can permanently leave these methods in your code and they automatically kick in when you use the debug options. The declarations in this part are visible to all Java code in actions in the BNF javacx. This controls where output files are generated. A match for a complex regular expression is a concatenation of matches to the complex regular expression units.
JavaCC – Wikipedia
Special tokens javafc useful in the processing of lexical entities such as comments which have no significance to parsing, but still are an important part of the input file. Each BNF production has a left hand side which is a non-terminal specification. If true, all methods and class variables are documentatkon as static in the generated parser and token manager. JJTree defines a Java interface Node that all parse tree nodes must implement. Tokens in the grammar files follow the same conventions as for the Java programming language.
If javaccc local lookahead specification is not at a choice point, then the syntactic lookahead is ignored – hence a default value is not relevant. A character list is a list of character descriptors separated by commas within square brackets.
Then a legal parse of the expansion unit is any token that matches this regular expression. The non-terminal is written exactly like a declared Java method. JJTree operates in one of two modes, simple and multi for want of better terms. Actions are not executed during lookahead evaluation. An expansion is written as a sequence of expansion units. A regular expression production documetation used to define lexical entities that get processed by the generated token manager.
Setting this option to true causes the token manager to generate a trace of its actions. This option is used to obtain debugging information from the generated token manager. A brief description of each kind of lookahead constraint is given below: A match for a complex regular expression choice is a match of any of its constituent complex regular expressions.