[antlr-interest] Possible Antlr defect?

Terence Parr parrt at cs.usfca.edu
Sat Jun 9 17:38:12 PDT 2007


On Jun 9, 2007, at 5:25 PM, Stuart Dootson wrote:
> But - don't all tokens need to be defined *somewhere*? For example, on
> page 179 of the PDF of the book, we find the follwoing statement:
>
> 'The imaginary token must be defined elsewhere in a grammar or in the
> tokens section.'
>
> I thought that was the idea of the 'tokens' section - to provide a
> mechanism for defining tokens not produced by the lexer, meaning that
> all tokens were defined somewhere? And if all tokens are defined, you
> have a complete list of them that you can validate token usage
> against?

That "elsewhere in a grammar" is the key.  Just referencing a token  
defines it as well as using the tokens section.
Ter



More information about the antlr-interest mailing list