[antlr-interest] Possible Antlr defect?
Gavin Lambert
antlr at mirality.co.nz
Sat Jun 9 20:16:13 PDT 2007
At 13:08 10/06/2007, Terence Parr wrote:
>
>Yep. It is vulnerable to typos, but only comes up when you're
>building separate parser and lexer (or a tree parser I guess).
As with any compiled language, I think it's far better to require
declaration before use to prevent this sort of problem. It's
trivial to declare any fake tokens required in a "tokens" block,
so the cost of requiring predeclaration is (in my opinion) vastly
less than the cost of *not* requiring predeclaration, where you
spend hours of pain and torment trying to figure out why something
isn't working, finally noticing a simple misspelling or
transposition error. (And yes, I've had that happen to me before
with other [usually interpreted] languages that didn't enforce
predeclaration, so I know whereof I speak.)
>I think ANTLRWorks puts a red squiggly line underneath if it
>is not defined. I will have to check.
It does, at least in the combined grammar case (I haven't tested
the imported vocab case).
More information about the antlr-interest
mailing list