[antlr-interest] separating lexer and parser rules

Johannes Luber jaluber at gmx.de
Fri Dec 21 09:45:52 PST 2007


Mark Volkmann schrieb:
> If I put my lexer and parser rules in separate grammar files, what do
> I have to do in the parser grammar so it is aware of the lexer rules?
> When I try to generate the parser class I get lots of error messages
> that say "literal has no associated lexer rule".
> 

Add in the parser options:

tokenVocab=LexerName;

LexerName has to be the names of the .tokens file of your lexer with the
file ending.

Johannes


More information about the antlr-interest mailing list