I have two rules that are mutually left recursive:
frag : ID
| NUMBER
| TRUE
| FALSE
| expr
;
expr: frag (PLUS | MINUS) frag
| LBR expr RBR
| frag
;
And the issue is:
The following sets of rules are mutually left-recursive [frag, expr]
I'm new to ANTLR4 and am having difficulty removing this mutual left recursion.
I understand that left recursion can be removed such that:
A -> Aa | b
-- becomes --
A -> bR
R -> aR | ε
See this answer here
How might I go about this?