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

micha micha-1 at fantasymail.de
Tue Feb 10 08:10:12 PST 2009


On Tuesday 10 February 2009 16:50:48 Carter Cheng wrote:
> 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); } )+
>
> 	;

I think you want to  insert the return value from varDecl, so  you can write 
$vars.insert($v.var)
(i.e. use the name you gave to the return value in the rule)

the other rule should work similar...

cheers,
 Michael




More information about the antlr-interest mailing list