that has been my experience as well with tree rule rewrites.<br>the re-written node must be composed of pre-existing rule reference(no parameters) or the construction of a new token.<br><br>-Bernardo<br><br><br><div class="gmail_quote">
On Wed, Jul 2, 2008 at 2:06 PM, Gavin Lambert &lt;<a href="mailto:antlr@mirality.co.nz">antlr@mirality.co.nz</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
At 14:57 2/07/2008, Bernardo Elayda wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&gt;def : ^(DEF name expr) -&gt; ^(DEF name $expr.value)<br>
I tried some additional experiments. &nbsp;I don[&#39;t think you can access the attribute &#39;value&#39; in the context of a tree rewrite.<br>
</blockquote>
<br>
Have you tried this:<br>
<br>
def : ^(DEF name expr) -&gt; ^(DEF name {$expr.value}) ;<br>
<br>
(Not sure if that&#39;s right either, but I have seen some examples using something similar.)<br>
<br>
Having said that, AST nodes can usually only be tokens -- you can&#39;t add a raw string to it. &nbsp;So you&#39;ll probably need to do something like this instead:<br>
<br>
def : ^(DEF name expr) -&gt; ^(DEF name STRING[$expr.value]) ;<br>
<br>
(Not entirely sure about that syntax, but it&#39;s something like that.)<br>
<br>
</blockquote></div><br>