[antlr-interest] Newbie Question: what does missing attributeaccess on rule scope: e mean?

Jim Idle jimi at temporal-wave.com
Thu Jun 14 09:53:21 PDT 2007


You should use $e.value, rules can return more than one element. I fit
does only return one element then the code gen will optimize it to do
so. So, $e references the "structure/object that contains the return
elements", and not the return element itself.

 

Jim

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Henri De Feraudy
Sent: Thursday, June 14, 2007 9:15 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Newbie Question: what does missing
attributeaccess on rule scope: e mean?

 

Hi all,

  My grammar is dead simple:

 

grammar Debug1;

options{
language=CSharp;
}

 

list   : e=element {foo($e);} (element)*;


element returns[object value] : 
 INT {$value = (object)int.parse($INT.text);}|
 STRING {$value = (object)$INT.text;}
 ;


INT : 
 ('0'..'9')+
 ;
STRING : 
 '"'.*'"'
 ;

 

Unfortunately I get the above error message (error 117) when I call on
Generate Code.

There doesnt seem to be any error message summary in The Definitive
ANTLR Reference

Whatsmore the console contains nothing after the message box appears.

I also searched for attribute access in the Reference and found nothing.

I guess this occurs because I am finding the Reference difficult to
read, but any help would

be most welcome.

Henri

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070614/f358c8d8/attachment.html 


More information about the antlr-interest mailing list