[antlr-interest] Re: amount of reserved keywords

Silvain Piree s.piree at enneya.com
Tue Jun 25 01:39:01 PDT 2002


> This is not a solution, because with the parser rule 'keyword'
> all words "NATURAL", "JOIN", ... becomes reserved 
> keywords :) A good way would it be, if ANTLR gives the 
> posibility to  say, "attention, this is a non reserved keyword".

The solution works, I've used it often.

Given input:
    
    IF IF THEN

and grammar:

    statement: "if" identifier "then" ;
    identifier: IDENTIFIER | keyword ;
    keyword: "if" | "then" ;

works fine, whereas:

    statement: "if" IDENTIFIER "then" ;

wouldn't work.

Silvain




 

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



More information about the antlr-interest mailing list