[antlr-interest] tokens in parser grammar

Jim Idle jimi at temporal-wave.com
Wed Aug 12 07:40:45 PDT 2009


Юрушкин Михаил wrote:
> Good day,
> Is it possible to write the following:
> "int_literal: CHAR_STRING "_" kind ..."
>   

Literals are single quoted.
> or I must specify the token UNDERSCORE in lexer grammar and write
>
> "int_literal: CHAR_STRING UNDERSCORE kind ...".
>   
It is much better to do this as then the lexer rules will be explicit as 
you won't get confused over ambiguities.
> C target. Last version of Antlr
>
>   
The target does not make a difference in this case, but thank you for 
mentioning this as it sometimes does :-)

Jim



More information about the antlr-interest mailing list