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):||16 October 2012|
|PDF File Size:||7.5 Mb|
|ePub File Size:||3.79 Mb|
|Price:||Free* [*Free Regsitration Required]|
JJTree keeps its state in a parser class field called jjtree. This option may be set to the name of a class that will be used as the base class for the generated Token class. It provides basic machinery for constructing the parent and child relationships between nodes.
JavaCC™: Documentation Index
Setting this option javscc true causes the parser to generate a trace of its actions. Following this is a description of what kind of regular expression production this is see below for what this means. JavaCC Java Compiler Compiler is an open-source parser generator and lexical analyzer generator written in the Java programming language.
The typical LL 1 grammar for this is:. A local lookahead specification is used to influence the way the generated parser makes eocumentation at the various choice points in the grammar.
Increasing this can give you more comprehensive ambiguity information at the cost of more processing time.
You can further customize the generated tree: In such cases, it’s best to leave this option at its default value. Parsing functions can take in parameters, return results, and invoke blocks of arbitrary Java code. We recommend the following step-by-step process to learning JavaCC:.
JavaCC – Wikipedia
This is docummentation boolean expression that is evaluated whenever havacc parser crosses this point during parsing. An expansion unit can be a non-terminal the last choice in the syntax above. Node Scopes and User Actions Each node is associated with a node scope. The input being parsed matches this regular expression if the token manager is in a lexical state for which this regular expression applies and the next set of characters in the input stream is the same possibly with case ignored as this string literal.
Special tokens are passed to the parser by linking them to neighboring real tokens using the field “specialToken” in the Token class. This option setting controls lookahead ambiguity checking performed by JavaCC.
A quick and dirty way to do what most real parsers do, namely generate an abstract syntax tree, is to embed the tree classes in the JJ file, like so:. In the sample code used below, it is assumed that the name of the generated parser is “TheParser”. The parenthesized set of expansion choices can be suffixed optionally by: When the ” ” is present, the regular expression is referred to as a “private regular expression”.
This allows only one parser object to be present, but it improves the performance of the parser. JJTree provides some basic support for the visitor design pattern. InSun Microsystems released a parser generator called Jack. This is a string option whose default value is “”, meaning that Tokens will be created by calling Token. There is also an interpreter for a simple language that uses JJTree to build the program representation. If you don’t provide implementations for the node classes JJTree will generate sample implementations based on SimpleNode for you.
JavaCC [tm]: API Routines
Setting it to false causes errors due to parse errors to be reported in somewhat less detail. There are two parts on the right hand side of an BNF production. The generated token manager provides one public method: Such references in regular expressions cannot introduce loops in the dependency between tokens.
This may be any arbitrary Java compilation unit so long as it contains a class declaration whose name is the same as the name of the generated parser “MyParser” in the above example.
Then a legal parse xocumentation the expansion unit is any token that matches this regular expression. The grammar file starts with a list of options which is optional.
JavaCC API Documentation
JavaCC performs many syntactic and semantic checks on the grammar file during parser generation. From Wikipedia, the free encyclopedia. For sophisticated, or bizarre, parsing, sometimes semantic lookahead is needed.
This method throws a ParseError exception when there is a lexical error, i. This controls where output files are generated.