I'm trying to play around with left recursive grammar rules in ANTLR4. My understanding is that as long as the rule isn't indirectly recursive, it should work. The first viable alternative should be the path chosen.
So why is it that the following grammar doesn't compile? As far as I can tell it seems fairly straight forward.
grammar Hello;
stat: stat* '}'
| ID
;
ID: [A-Za-z0-9]+;
WS: [ \t\r\n]+ -> skip;
ANTLR keeps erroring out with...
error(119): Hello.g4::: The following sets of rules are mutually left-recursive [stat]
*to be greedy because this leads to the recursive evaluation of stat which will never return if greedyness is assumed. - CoronA