[antlr-interest] I'm so stupid or there are inaccuracy in java tree parser grammar
dk0879
diver7 at mail.ru
Tue Apr 29 00:57:09 PDT 2003
Hi, implemented "tiny java" interpreter based on
java grammar from ANTLR, and found out that "FOR_INIT"
statement rule can't process code like this:
for (int i = 0, j = 0; ... )
because it expect zero or one "variableDef" node:
stat:
...
| #( "for"
#(FOR_INIT (variableDef | elist)?) // <-- ?
#(FOR_CONDITION (expression)?)
#(FOR_ITERATOR (elist)?)
stat
)
| ...
when I modify it:
stat:
...
| #( "for"
#(FOR_INIT ((variableDef)+ | elist)?) // <-- !
#(FOR_CONDITION (expression)?)
#(FOR_ITERATOR (elist)?)
stat
)
| ...
my parser began to work.
Are the original java grammar is correct?
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list