[antlr-interest] Why the generated parser code tolerates illegal expression?

Clifford Heath clifford.heath at gmail.com
Wed Nov 28 20:19:23 PST 2007


William Cai wrote:
> 
> I'm adding the item. By the way, why not add some check code in the 
> generated parser so that we need not declare EOF explicitly? Is this 
> already done in ANTLR v3, or still in to-do list, or just impossible to 
> implement?

I suspect that the rules that call the rule you're trying to interpret
will be relying on that rule only succeeding in a valid situation, i.e.
not when followed by EOF. To change this might cause parse errors in the
calling rule, which might have another way of parsing the input that
does succeed.

That said, it would be nice if ANTLRWorks was able to arbitrarily insert
such a rule when you choose to interpret like this.

Clifford Heath.



More information about the antlr-interest mailing list