[antlr-interest] ANTLR 3.0b4 code generation question

Jim Idle jimi at intersystems.com
Mon Oct 30 11:49:39 PST 2006


You are assigning the value of a rule return (command) to a label, but your parser is not producing a tree (in which case the return value is the tree) and your rule is not returning anything (returns clause). The return type of command is therefore void and you get the code you see. 

Admittedly, ANTLR should point this out to you, but I believe such things are being deferred until the point where the ANTLR3 grammar parser is written in ANTLR3.

Jim

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Foolish Ewe
Sent: Friday, October 27, 2006 6:10 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] ANTLR 3.0b4 code generation question

Hello All:

Thanks for the wonderful hints so far.  I've noticed some unusual java code 
generated
under ANTLR3, and I'm wondering if it is a cockpit error or if I might be 
tickling an ANTLR3 bug.

The MIME attached smalltest.g using my recently downloaded version of 
ANTLRworks creates
the following line in the parser:
       void c = null;

Is this correct Java, or did I do something wrong to cause this?

Regards:

Bill Maniatty

_________________________________________________________________
All-in-one security and maintenance for your PC.  Get a free 90-day trial! 
http://clk.atdmt.com/MSN/go/msnnkwlo0050000002msn/direct/01/?href=http://www.windowsonecare.com/?sc_cid=msn_hotmail

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 10/27/2006
 
  

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.17/505 - Release Date: 10/27/2006
 


More information about the antlr-interest mailing list