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.

Author: Gardasho Bagami
Country: Guyana
Language: English (Spanish)
Genre: Literature
Published (Last): 3 August 2013
Pages: 99
PDF File Size: 10.23 Mb
ePub File Size: 18.73 Mb
ISBN: 375-1-81754-465-6
Downloads: 64566
Price: Free* [*Free Regsitration Required]
Uploader: Zur

By providing a custom superclass you may be able to avoid the need to edit the generated SimpleNode.

An expansion unit can be a set of Java declarations and code enclosed within braces the Java block. The value of this option is emitted in the JavaCC source.

This is a boolean option whose default value is false. You can give it a different name with the following syntax:. The order they are added is documrntation specified. In addition, the two methods – getToken int i and getNextToken can also be used in actions to traverse the token list.

JavaCC [tm]: API Routines

The general approach is to replace rules of the form. N a is ambiguous; you have to use the explicit condition: Following this is a description of what kind of regular expression production this is see below for what this means. If a local lookahead specification has been provided, but not all lookahead constraints have been included, then the missing ones are assigned default values as follows:. Explicitly setting this option allows the user to separate the parser from the tree files.


They are both called with the current node as a parameter. This returns true if the node’s condition was satisfied and the node was created and pushed on the node stack, and false otherwise.

The regular expressions in this regular expression production describe tokens in the grammar. Hence, every time this non-terminal is used in the parsing process, these declarations and code are executed.

The parser state implements an open stack where nodes are held until they can be added to their parent node. The methods must have the following signatures:. The parsing functions look rather like the EBNF for a grammar: By default, Java Unicode escapes are not processed. Then any legal parse of the expansion unit is one or more repetitions of a legal parse of the parenthesized set of expansion choices.

This is an integer option whose default value is 2. See the minitutorial on the token manager for more details. In a real compiler, you don’t dump a main method into the parser. To help with creating your error reporting scheme, the following variables are available:. Each call to this method returns the next token in the input stream.


In which case, a legal parse of the expansion unit is any legal parse of the nested expansion choices. Such references in regular expressions cannot introduce loops in the dependency between tokens. Setting this option to true causes the generated token manager to ignore case in the token specifications and the input files.

JavaCC Java Compiler Compiler is an open-source parser generator and lexical analyzer generator written in the Java programming language.

JavaCC Documentation

There are also ways to make “private” tokens, and write complex regular expressions. When the code within it executes, the node’s children have already been popped from the javqcc and added to the node, which has itself been pushed onto the stack. In those cases the shorthand must be replaced by the full expression. When JavaCC processes the Java block, it does not perform any detailed syntax or semantic checking.

A bunch of useful constants. This lookahead limit applies only to the choice point at the location of the local lookahead specification. There can only be one token manager declaration in a JavaCC grammar file. The generated token manager receives characters from this stream reader.