[antlr-interest] (newbie problem) rewrite rule question
Randall R Schulz
rschulz at sonic.net
Tue Jul 10 19:01:33 PDT 2007
On Tuesday 10 July 2007 18:52, ali azimi wrote:
> Hi,
>
> My parser has been produced by the antlr. The word "return" has
> also been produced by the grammar. I do not understand why it should
> complain about it. What should I change it to? it sounds complicated.
Perhaps ANTLR does not modify Java keywords such as "return" and hence
syntax error chaos ensues?
I did a quick check by adding this production to a working grammar of
mine:
return
: 'return'
;
ANTLR does not complain when I apply it to the grammar with this
addition. However, when Ant runs javac on the result produced by ANTLR,
this results:
[javac] Compiling 3 source files to /dar/tau/obj
[javac] /dar/tau/src/tau/cl/CLIFParser.java:3235: <identifier> expected
[javac] public final return_return return() throws RecognitionException {
[javac] ^
[javac] /dar/tau/src/tau/cl/CLIFParser.java:3235: <identifier> expected
[javac] public final return_return return() throws RecognitionException {
[javac] ^
[javac] 2 errors
> Al
More information about the antlr-interest
mailing list