[antlr-interest] Why and how exactly does ANTLR manage to fail on non recursive grammar for finite language?

David-Sarah Hopwood david-sarah at jacaranda.org
Wed Aug 12 20:24:00 PDT 2009


David-Sarah Hopwood wrote:
[...]
> The default of not enabling backtracking is the right default, since the
> ambiguity warnings are more conservative and more likely to help in
> finding grammar errors. (To me this is more important than the loss
> of efficiency that can result from backtracking.) In this case, the
> left-factoring suggested by Jim Idle is a better solution than enabling
> backtracking, even though the latter would handle this particular
> grammar automatically...

... if the expr rule were changed to (expr1 | expr2) EOF, which is
needed anyway to reflect the intent of a finite language.

-- 
David-Sarah Hopwood  ⚥  http://davidsarah.livejournal.com



More information about the antlr-interest mailing list