Thanks for reply.&nbsp; the funny thing is after I sent the email, I realized what I was missing, but I came across some new rules I was sure how to translate.<br><br>such as:<br>
<br>propOrIdent[LinkedListTree identPrimary, Token startToken]<br>&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { retval.start = startToken; }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; d=DOT propId=qualifiedIdent<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt; ^(PROPERTY_OR_IDENTIFIER[$d] {$identPrimary} $propId)<br>

&nbsp;&nbsp;&nbsp; ;<br><br>and<br><br>xmlLiteral<br>&nbsp;&nbsp;&nbsp; @init {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LinkedListTree xml = null;<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; :<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; LT<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; { xml=parseXMLLiteral(); }<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt; ^(XML_LITERAL {xml})<br>&nbsp;&nbsp;&nbsp; ;<br>I haven&#39;t found any leads on how to translate the &quot;action
inserted&quot; {} nodes.&nbsp; I&#39;m not sure what to call them.&nbsp; Looking at the
resulting parser code comments for the xmlLiteral rule it doesn&#39;t look
like ANTLR sees the special nodes.&nbsp; <br>
<br>&nbsp;root_0 = (LinkedListTree)adaptor.nil();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // 1121:3: -&gt; ^( XML_LITERAL )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // AS3.g3:1121:6: ^( XML_LITERAL )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LinkedListTree root_1 = (LinkedListTree)adaptor.nil();<br>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; root_1 = (LinkedListTree)adaptor<div id="1es9" class="ArwC7c ckChnd">.becomeRoot(adaptor.create(XML_LITERAL, &quot;XML_LITERAL&quot;), root_1);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adaptor.addChild(root_1, xml);<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adaptor.addChild(root_0, root_1);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>So how would I go about translating the rules in a tree grammar?<br><br>xmlLiteral : ^(XML_LITERAL WHATGOESHERE?) ;<br><br>Thanks,<br><font color="#888888">Don</font></div><br>
<br><div class="gmail_quote">On Wed, May 7, 2008 at 3:25 PM, David Holroyd &lt;<a href="mailto:dave@badgers-in-foil.co.uk">dave@badgers-in-foil.co.uk</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;">
Hello,<br>
<div class="Ih2E3d"><br>
On Mon, Apr 28, 2008 at 02:28:50PM -0700, Don-Duong Quach wrote:<br>
&gt; I&#39;m trying to build an Actionscript 3 to haxe <a href="http://haxe.org" target="_blank">http://haxe.org</a> translator,<br>
&gt; and I&#39;ve been taking a closer look at metaas to see if I could reuse the AS3<br>
&gt; and island grammars as the basis for it. &nbsp;I thought I might as well try to<br>
&gt; build something robust with ANTLR than hand code a translator, but I&#39;ve into<br>
&gt; a couple snags with building the project.<br>
&gt;<br>
&gt; I was hoping maybe David Holroyd or someone would give me some pointers on<br>
&gt; how to alter the grammar into a tree grammar for rewriting as I&#39;m still<br>
&gt; learning how to use ANTLR.<br>
&gt;<br>
&gt; Just as a side note, I setup Netbeans with a Maven plugin to build the<br>
&gt; metaas project but ran into some dependency issues with the maven-archiver,<br>
&gt; plexus-archiver and plexus-components. &nbsp;I stopped trying to resolve them at<br>
&gt; that point because I wanted to focus on the task of the tree grammar.<br>
<br>
</div>I&#39;m afraid I have no experience of Netbeans/Maven integration, so I<br>
can&#39;t really help out there. &nbsp;Were you able to get things to work with<br>
the plain-old Maven command line interface?<br>
<div class="Ih2E3d"><br>
<br>
&gt; I&#39;ve been reading through the docs and examples, but I don&#39;t know I would<br>
&gt; translate the certain parser rewrites into a tree grammar rule. &nbsp;For<br>
&gt; example:<br>
&gt;<br>
&gt; classDefinition[LinkedListTree annos, LinkedListTree mods]<br>
&gt; &nbsp; &nbsp; : &nbsp; &nbsp;CLASS ident<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; classExtendsClause<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; implementsClause<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; typeBlock<br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; -&gt; ^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>
&gt; implementsClause typeBlock)<br>
&gt; &nbsp; &nbsp; ;<br>
&gt;<br>
&gt; In The Definitive Guide to ANTLR, Terrence Parr says to copy the rules over<br>
&gt; like so:<br>
&gt;<br>
&gt; classDefinition[LinkedListTree annos, LinkedListTree mods]<br>
&gt; &nbsp; &nbsp; : &nbsp; &nbsp;^(CLASS_DEF {$annos} {$mods} ident classExtendsClause<br>
&gt; implementsClause typeBlock)<br>
&gt; &nbsp; &nbsp; ;<br>
<br>
</div>Note that you would not need to pass the [annos,mods] arguments to this<br>
rule in the tree parser. &nbsp;The main parser will already have inserted<br>
these into the resulting tree.<br>
<div class="Ih2E3d"><br>
<br>
&gt; But what would I do about the {$annos} and {$mods} elements in the rule? &nbsp;I<br>
&gt; figure the parameter clause should be removed, but what should I use to<br>
&gt; reference the annos and mods elements in the AST?<br>
<br>
</div>You need to consider what structure the tree parser will actually<br>
observe.<br>
<br>
In the above example, {$annos} and {$mods} are references (passed as<br>
arguments to the rule) to some subtrees. &nbsp;In your tree parser, you would<br>
need to address the concrete tree structure that will be produced that<br>
these points.<br>
<br>
If you look at the rules that may invoke the classDefinition rule,<br>
you&#39;ll see that $annos and $mods are the subtrees produced by the rules<br>
&#39;annotations&#39; and &#39;modifiers&#39; respectively.<br>
<br>
Therefore, you could write the rule in the tree parser like...<br>
<br>
<br>
 &nbsp;classDefinition<br>
 &nbsp; &nbsp; &nbsp;: &nbsp; &nbsp;^(CLASS_DEF annotations modifiers ident classExtendsClause implementsClause typeBlock)<br>
<br>
<br>
does that make sense?<br>
<br>
<br>
ta,<br>
dave<br>
<font color="#888888"><br>
--<br>
<a href="http://david.holroyd.me.uk/" target="_blank">http://david.holroyd.me.uk/</a><br>
<br>
_______________________________________________<br>
metaas-dev mailing list<br>
<a href="mailto:metaas-dev@lists.badgers-in-foil.co.uk">metaas-dev@lists.badgers-in-foil.co.uk</a><br>
<a href="http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev" target="_blank">http://lists.badgers-in-foil.co.uk/mailman/listinfo/metaas-dev</a><br>
</font></blockquote></div><br>