public class LeftRecursiveRuleTransformer extends Object
| Modifier and Type | Field and Description |
|---|---|
GrammarRootAST |
ast
|
Grammar |
g
|
static String |
PRECEDENCE_OPTION_NAME
|
Collection |
rules
|
static String |
TOKENINDEX_OPTION_NAME
|
Tool |
tool
|
| Constructor and Description |
|---|
LeftRecursiveRuleTransformer(GrammarRootAST
|
| Modifier and Type | Method and Description |
|---|---|
RuleAST |
parseArtificialRule(Grammar
|
void |
setAltASTPointers(LeftRecursiveRule
(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
Return true if successful
|
void |
translateLeftRecursiveRules()
|
public static final StringPRECEDENCE_OPTION_NAME
public static final StringTOKENINDEX_OPTION_NAME
public GrammarRootASTast
public Collection<Rule > rules
public Grammarg
public Tooltool
public LeftRecursiveRuleTransformer(GrammarRootASTast, Collection <Rule > rules, Grammar g)
public void translateLeftRecursiveRules()
public boolean translateLeftRecursiveRule(GrammarRootASTast, LeftRecursiveRule r, String language)
public void setAltASTPointers(LeftRecursiveRuler, 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}? '--'))))))