[antlr-interest] Request option to check for undefined tokens in tree grammar, Antlr 3.0

Gavin Lambert antlr at mirality.co.nz
Wed Aug 1 13:56:18 PDT 2007


At 08:14 2/08/2007, Hardy, Stephen wrote:
 >Would it be possible to add an option to a tree grammar to make
 >Antlr issue a warning if tokens were defined but not defined in
 >the *.tokens file?  I would recommend enabling the warning by
 >default, since most users (I think) would not want to define
 >additional tokens in the tree grammar which weren't in the
 >parser grammar.

I recall suggesting something similar a while back, except for 
tokens mentioned in the parser of a combined grammar but without a 
lexer rule or an entry in the tokens block.  Bit me a few times :)

It'd be handy to have a strict mode to avoid this sort of 
thing.  It's much better to have a compile-time error if you use 
something undeclared than to have it magically create whatever 
you're referring to -- especially when that reference was 
unintended.



More information about the antlr-interest mailing list