[antlr-interest] Attribute Access in Tree Grammar Actions

Gavin Lambert antlr at mirality.co.nz
Fri Jun 29 15:28:15 PDT 2007


At 10:16 30/06/2007, Randall R Schulz wrote:
 >atomicSentence
 >returns [ Formula f ]
 >  : equation
 >    {
 >      f = $equation;
 >    }
 >
 >  | atom
 >    {
 >      f = $atom;
 >    }
 >  ;
 >
 >
 >I get these diagnostics from ANTLR:
 >
 >error(117): CLIFBuilder.g:1157:3: missing attribute access on 
rule
 >scope: equation
 >error(117): CLIFBuilder.g:1162:3: missing attribute access on 
rule
 >scope: atom

I think you need to use $equation.value and $atom.value.  Or 
something like that :)

And I think you're also supposed to say $f rather than just 
f.  Gives the code generator the opportunity to move things around.



More information about the antlr-interest mailing list