Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • 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 java.util.Map of the grammar's actions.

docComment

 

recognizer

The StringTemplate named "lexer", "parser", or "treeParser", depending on the type of recognizer being generated.

name

 

tokens

 

tokenNames

 

rules

 

cyclicDFAs

A org.antlr.analysis.DFA instance.

bitsets

 

buildTemplate

Boolean

buildAST

Boolean

rewriteMode

Boolean

profile

Boolean

backtracking

Boolean

synpreds

A java.util.Set of synpreds in the grammar (if any).

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

 

AST.stg

ASTParser.stg

ST.stg