[antlr-interest] Antlr bug?

Jim Idle jimi at temporal-wave.com
Mon Apr 16 17:00:22 PDT 2007


Miguel,

 

I remember seeing this somewhere, but I now do not remember if it was a
bug in my own grammar or indeed a code generation error. Anyway, I was
fairly sure that this was fixed (but I could be going mad). If it was
fixed, then in theory using the very latest ANLTRWorks will fix it,
unless it is really an ANTLRWorks bug. 

 

However, if you are running this in translation mode, try instead, the
debug mode (which is working again on ANTLRWorks b10).

 

I also recommend inserting an action to print out what you believe you
are gathering and running from the command line - this will tell you if
your grammar is sound etc.

 

Hope this helps a little.

 

Jim

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Miguel Ping
Sent: Monday, April 16, 2007 4:40 PM
To: ANTLR Interest
Subject: [antlr-interest] Antlr bug?

 

Hi all,

I'm writing a sql 2 java translator, and I have a strange bug.

I got this query:

SELECT  p.prop1, a.prop2, b.prop3, c.prop4 from properties


and antlr generates me this tree:

select
SELECT_LIST
   COLUMN_REFERENCE_LIST
      TABLE_ID
         p
      .
      prop1
   ,
   COLUMN_REFERENCE_LIST
      TABLE_ID
         c
      .
      prop4
   ,
   COLUMN_REFERENCE_LIST 
      TABLE_ID
         c
      .
      prop4
   ,
   COLUMN_REFERENCE_LIST
      TABLE_ID
         c
      .
      prop4
from
TABLE_REFERENCE_LIST
   TABLE_ID
      properties


If you notice carefully, antlr is replacing all identifiers (table and
column ids)with the last one, except for the first. the tree should be
reading p,a,b,c TABLE_ID's and prop1,2,3,4 . This happens for an
arbitrarily big column list; only the first one gets it right. I think I
may have a bug with some list creation in my parser, but debugging in
antlrworks (great work btw, debugger is really neat) shows me the
correct identifiers. 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070416/4ffe00b0/attachment-0001.html 


More information about the antlr-interest mailing list