[antlr-interest] Ways to specify tokens
Martin Probst
mail at martin-probst.com
Thu Apr 7 10:20:29 PDT 2005
Hi,
> There appear to be 2 ways to specify tokens and I'm not sure of the
> difference. The manual says it's:
>
> Tokenspec: tokens { token1; token2; token3;… }
Actually I'm only aware of one type, and that is by writing "tokens
{ ... }". The case above is IMHO a badly written manual. The whole ANTLR
manual seems at least in part to be written a little bit too much from
the developers perspective.
The above line is probably derived from the ANTLR internal parsing rule,
but definetly not what the user has to enter.
Apart from "tokens {}" you can of course also just write in your grammar
"EQ" and ANTLR will generate a LITERAL_EQ token. That's convenient but
especially if you want to do something with those tokens the former
method is better, I think.
Regards,
Martin
More information about the antlr-interest
mailing list