[antlr-interest] Grammars with too many keywords?
Vadim Tropashko
vadimtro at yahoo.com
Thu Mar 1 09:33:29 PST 2007
The grammar that I'm working on allows keywords as
identifiers. For example, "A" is a keyword, as a part
a part of very reasonable declaration:
set_predicate:
is_prefix d_o_tNOTd_o_t 'A' 'SET'
;
Naturally, the "A" can be identifier as well:
IDENTIFIER:
('a'..'z'|'A'..'Z') ( 'a'..'z'|'A'..'Z'
...)*;
So whenever I feed into the parser text like this:
A := ...
I'm getting
mismatched input 'A' expecting IDENTIFIER
Is there a standard way to approach this problem?
Preferably, the solution should contain as little
redundancies as possible. For example, I could collect
all the keywords and declare them as such, but do I
really have to? Isn't grammar terminal symbol already
assumed to be a keyword?
____________________________________________________________________________________
Looking for earth-friendly autos?
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
http://autos.yahoo.com/green_center/
More information about the antlr-interest
mailing list