[antlr-interest] Lexer and Parser class packaging

Martin Probst mail at martin-probst.com
Mon Feb 5 11:14:15 PST 2007


Hi,

> Also, now that the book is virtually out the door, such things  
> should be
> much less of an issue providing the book is read beforehand.

Come on, you don't really believe people will start reading manuals,  
do you? :-)

> One possibility though is to not have a default for the @header {}  
> which
> will then just leave @lexer::header and @parser::header, which are
> probably more obvious.

The standard language is Java, and the standard use case for the  
header in that language is setting the package. The only other thing  
you can do there is add additional imports, which are probably  
identical for Parser and Lexer, too (or you just import all in both  
and don't care...).  I think the cases where people want different  
things for lexer/parser in the header are really corner cases. Stuff  
should work by default.

So I think this is indeed not a very user friendly design as the  
default of what the user wants and the default of what ANLTR does and  
requires do not really agree.

Regards,
Martin




More information about the antlr-interest mailing list