...
- Start with a simple lexer like:
Code Block |
---|
lexer grammar T;
options { language = XYZ; }
ZERO: '0';
|
...
Parameter Name | Description |
---|---|
LEXER | Boolean indicating that a Lexer is being generated. |
PARSER | Boolean indicating that a Parser or Combined Lexer/Parser is being generated. |
TREE_PARSER | Boolean indicating that a Tree Parser is being generated. |
actionScope |
|
actions | A |
docComment |
|
recognizer | The StringTemplate named "lexer", "parser", or "treeParser", depending on the type of recognizer being generated. |
name |
|
tokens |
|
tokenNames |
|
rules |
|
cyclicDFAs | A |
bitsets |
|
buildTemplate | Boolean |
buildAST | Boolean |
rewriteMode | Boolean |
profile | Boolean |
backtracking | Boolean |
synpreds | A |
memoize | Boolean |
numRules |
|
fileName |
|
ANTLRVersion | String containing the version of the ANTLR tool generating this recognizer. |
generatedTimestamp | String containing the current time. |
trace | Boolean |
scopes |
|
superClass |
|
literals |
|
rule()
StringTemplate
The rule()
StringTemplate is instantiated by ANTLR's own grammar processing. It takes the following parameters.
Parameter Name | Description |
---|---|
ruleName | The name of the rule as specified in the input grammar. |
ruleDescriptor |
|
block |
|
emptyRule |
|
description |
|
exceptions |
|
finally |
|
memoize |
|