[antlr-interest] tokens in parser grammar

Sam Barnett-Cormack s.barnett-cormack at lancaster.ac.uk
Wed Aug 12 07:25:51 PDT 2009


Юрушкин Михаил wrote:
> Good day,
> Is it possible to write the following:
> "int_literal: CHAR_STRING "_" kind ..."
> 
> or I must specify the token UNDERSCORE in lexer grammar and write
> 
> "int_literal: CHAR_STRING UNDERSCORE kind ...".
> 
> C target. Last version of Antlr

If it's a combined grammar, that'll work, but it's better in many ways 
to put it in the lexer as a token.

If the lexer and parser are separate, I believe it won't work.


-- 
Sam Barnett-Cormack


More information about the antlr-interest mailing list