Fwd: [antlr-interest] Can it be a bug in antlr 3?

Jose Ventura jose.ventura.roda at gmail.com
Tue Jun 27 03:01:48 PDT 2006


I think the problem is the EOF token

programa: (sentencia ';')+ EOF -> ^(PROGRAMA sentencia+); //this's not ok

programa: (sentencia ';')+ -> ^(PROGRAMA sentencia+); //this's ok

---------- Forwarded message ----------
From: Jose Ventura <jose.ventura.roda at gmail.com>
Date: Jun 27, 2006 11:24 AM
Subject: Fwd: [antlr-interest] Can it be a bug in antlr 3?
To: antlr-interest at antlr.org



No, this is the error detected by java compiler.

I think  "list_-1" is a bug in the java code generated by antlr, or an error
in my grammar ;-)

---------- Forwarded message ----------
From: Michiel Vermandel <Michiel_Vermandel at axi.be>
Date: Jun 27, 2006 11:20 AM
Subject: Re: [antlr-interest] Can it be a bug in antlr 3?
To: Jose Ventura <jose.ventura.roda at gmail.com>



Is "*list_-1*" a valid variable name?




  *"Jose Ventura" <jose.ventura.roda at gmail.com >*
Sent by: antlr-interest-bounces at antlr.org

27/06/2006 11:14
   To
antlr-interest at antlr.org  cc
  Subject
[antlr-interest] Can it be a bug in antlr 3?




I don't know if this is a bug or a error in my grammar. This occur in a
debug session of antlrworks with these version tools  ANTLRWorks 1.0ea9
ANTLR 3.0ea10 StringTemplate 2.3b7 XJLibrary 1.2.6 Java 1.5.0_02 (Sun
Microsystems Inc.)

With this grammar


grammar Transformer;
options {output=AST;}

tokens {PROGRAMA;}

programa: (sentencia ';')+ EOF -> ^(PROGRAMA sentencia+);
sentencia: setDir;
setDir : 'set' 'dir' LITERAL ;
LITERAL : '"'(options {greedy=false;}:.)* '"';



It generate this error

[11:05:51] C:\Documents and Settings\JVR3651A\My
Documents\java\Transformer\Transformer.java:65: ';' expected
[11:05:51]         List list_-1=new ArrayList();
[11:05:51]                   ^

because the java code generated is wrong

[...]

        List list_sentencia=new ArrayList();
       List *list_-1*=new ArrayList();
       List list_6=new ArrayList();
       Object char_literal2_tree=null;
       Object EOF3_tree=null;
[...]

It's a bug?

thank's in advance.

José Ventura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060627/780ff6a1/attachment.html


More information about the antlr-interest mailing list