[antlr-interest] Question about handling key words in grammars
Stefan Misch
stefan.misch at gmx.de
Sat Dec 11 09:56:20 PST 2010
Hi,
I'm just starting ANTLR and there are so many questions. AMZ delivered the
book today but...
Why do some grammmars define language keywords in different ways:
sometimes "inline" in a rule, e.g.
create_package
: 'CREATE' ( OR keyREPLACE )?
sometimes as explicit lexical tokens, e.g.
CREATE: 'CREATE'
sometimes as "keyword" like this:
keyREPLACE: {(this.input).LT(1).Text.ToUpper() == "REPLACE"}? ID;
One reason maybe that a keyX definition is case insensitive because of the
use of "ToUpper()".
Another reason why I'm asking is, that AntlrWorks 1.4.1 seems to have a
problem with these keyX, as I cannot use the interpreter. And the Debugger
seems to have another problem as it does just nothing (I've seen a recent
post that this seems to be a bug).
Thanks,
Stefan
Antlr 3.3, AntlrWorks 1.4.1, WinXP
More information about the antlr-interest
mailing list