[antlr-interest] Wrong generated code (Version 3.01b)

Jose Ventura jose.ventura.roda at gmail.com
Wed Jun 28 01:42:50 PDT 2006


Over all, I want to thank for Terence for new version of antlr

I apologize if this is a founded bug.

With the following grammar

*grammar a;*

*options {output=AST;}
tokens {PARMS;}*

*modulo
 : 'modulo' ID ('(' parms+ ')')? -> ^('modulo' ID ^(PARMS parms+)?)
 ;
parms : '#'|ID;
ID : ('a'..'z' | 'A'..'Z')*;
WS : (' ' | '\t' | '\n' | '\r')+ {channel=99;} ;
*

The compiler result is

*a.java:150: cannot find symbol
symbol  : variable n_1
location: class a
                if ( n_1 > 1 ) throw new RuntimeException(" list has > 1
elements");
                     ^
a.java:151: cannot find symbol
symbol  : variable n_1
location: class a
                if ( n_1==1 ) {
                     ^*

Any help is very much welcome
Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060628/8a5c052a/attachment.html


More information about the antlr-interest mailing list