[antlr-interest] Newbie - Help with keywords and IDs

defordusa defordusa at yahoo.com
Thu Jun 19 11:43:22 PDT 2003


I have an identified specified as:

TX : (ALPHA)(ALPHA)+
   ;

I also have several classes of keywords like this:

FP : "DE" | "LE" | "LA"
   ;

LP : "VAN" | "VON" | "MAC"
   ;

...
...
Also several others
...
...

My problem occurs because I cannot get this to work because of 
ambiguity and have thus moved FP and LP into the parser as fp and lp 
respecitively and added "options {testLiterals=true;}" to TX as well. 
This does not appear to be an ideal solution. I know I could have 
also created a "tokens" section in the lexer but then I have a one-to-
one correspondence between each literal string and token type instead 
of classes of tokens.

Is there another way of doing this so that I can keep the FP and LP 
in the lexer?


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list