[antlr-interest] tree grammar error (newbie)- missing attribute access

Carter Cheng carter_cheng at yahoo.com
Tue Feb 10 07:50:48 PST 2009


Hello,

I am getting a missing attribute access error on a number of rules which I do not quite understand and was hoping I might be able to get some help fixing them. The errors point to the following rules in the tree grammar. 


varDecls[std::list<std::string> & err] returns [std::map<Symbol,Type*> vars]
        : (v=varDecl { $vars.insert($v); } )+
	;

formalList returns [pair< std::list<Type*>, bool > p] 
	: { $p.second = false; } (t=formal { $p.first.push_back($t); } )* (ELLIPSIS { $p.second = true; } )?
	;

with 

varDecl returns [pair<Symbol,Type*> var]
	: t=type (s=STAR)? i=IDENT { $var = pair<Symbol,Type*>($i.text, $t); }
	;

formal returns [Type* type]
	: ^(FORMAL t=formalType (s=STAR)? IDENT) { $type = $t; }
	; 

I was searching through the archive on this but couldnt find a solution that seemed to work. i.e. changing $v --> $v.value gives an unknown attribute type error. Any help would be appreciated.

Thanks in advance,

Carter.


      
-------------- next part --------------
A non-text attachment was scrubbed...
Name: LPCCollect.g
Type: application/octet-stream
Size: 4087 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20090210/fbe3a653/attachment.obj 


More information about the antlr-interest mailing list