public class LeftRecursiveRuleTransformer extends Object
Modifier and Type | Field and Description |
---|---|
GrammarRootAST |
ast |
Grammar |
g |
static String |
PRECEDENCE_OPTION_NAME |
Collection<Rule> |
rules |
static String |
TOKENINDEX_OPTION_NAME |
Tool |
tool |
Constructor and Description |
---|
LeftRecursiveRuleTransformer(GrammarRootAST ast,
Collection<Rule> rules,
Grammar g) |
Modifier and Type | Method and Description |
---|---|
RuleAST |
parseArtificialRule(Grammar g,
String ruleText) |
void |
setAltASTPointers(LeftRecursiveRule r,
RuleAST t)
(RULE e int _p (returns int v)
(BLOCK
(ALT
(BLOCK
(ALT INT {$v = $INT.int;})
(ALT '(' (= x e) ')' {$v = $x.v;})
(ALT ID))
(* (BLOCK
(OPTIONS ...)
(ALT {7 >= $_p}? '*' (= b e) {$v = $a.v * $b.v;})
(ALT {6 >= $_p}? '+' (= b e) {$v = $a.v + $b.v;})
(ALT {3 >= $_p}? '++') (ALT {2 >= $_p}? '--'))))))
|
boolean |
translateLeftRecursiveRule(GrammarRootAST ast,
LeftRecursiveRule r,
String language)
Return true if successful
|
void |
translateLeftRecursiveRules() |
public static final String PRECEDENCE_OPTION_NAME
public static final String TOKENINDEX_OPTION_NAME
public GrammarRootAST ast
public Collection<Rule> rules
public Grammar g
public Tool tool
public LeftRecursiveRuleTransformer(GrammarRootAST ast, Collection<Rule> rules, Grammar g)
public void translateLeftRecursiveRules()
public boolean translateLeftRecursiveRule(GrammarRootAST ast, LeftRecursiveRule r, String language)
public void setAltASTPointers(LeftRecursiveRule r, RuleAST t)
(RULE e int _p (returns int v) (BLOCK (ALT (BLOCK (ALT INT {$v = $INT.int;}) (ALT '(' (= x e) ')' {$v = $x.v;}) (ALT ID)) (* (BLOCK (OPTIONS ...) (ALT {7 >= $_p}? '*' (= b e) {$v = $a.v * $b.v;}) (ALT {6 >= $_p}? '+' (= b e) {$v = $a.v + $b.v;}) (ALT {3 >= $_p}? '++') (ALT {2 >= $_p}? '--'))))))
Copyright © 1992–2020 ANTLR. All rights reserved.