[antlr-interest] Token tip

Tom Nurkkala tnurkkala at cse.taylor.edu
Tue Jul 28 16:13:28 PDT 2009


Quick tip if you are working with multiple grammars, say T.g (a lexer/ 
parser) and W.g (a tree grammar):

It's possible for the T.tokens and W.tokens file to get out of sync if  
you are renaming tokens.  If a token used by both grammars is called  
TKN, it will be defined to have different values in the two tokens  
files (e.g., TKN=7 in one file and TKN=22 in the other).  If you use  
ANTLRWorks (you should -- it's glorious!), you'll find that it will  
highlight the mismatched token with the wavy red underline.

The simplest solution is to simply delete both token files and re-run  
ANTLR on both grammars.  All better.

tom,



More information about the antlr-interest mailing list