Still one more;)<br><br>In treeSpec there is functionality missing to support suffixes. E.g. <br><br>r: ^(a b)+;<br><br>will not parse. Fixed it with this:<br><br><i>treeSpec<br>&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; &#39;^(&#39; element ( element )+ &#39;)&#39; ebnfSuffix? -&gt; ^(TREE_BEGIN element+ ebnfSuffix?)<br>
&nbsp;&nbsp;&nbsp; ;<br><br></i>Best regards,<br>Jens<br><br><div class="gmail_quote">2008/7/8 Jens Boeykens &lt;<a href="mailto:jens.boeykens@gmail.com">jens.boeykens@gmail.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Another error in ANTLRv3.g:<br><br><i>rewrite_tree_element<br>&nbsp;&nbsp;&nbsp; :&nbsp;&nbsp;&nbsp; rewrite_tree_atom<br>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; rewrite_tree_atom ebnfSuffix<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt; ^( ebnfSuffix ^(BLOCK[&quot;BLOCK&quot;] ^(ALT[&quot;ALT&quot;] rewrite_tree_atom EOA[&quot;EOA&quot;]) EOB[&quot;EOB&quot;]))<br>

&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp; rewrite_tree<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; (&nbsp;&nbsp;&nbsp; ebnfSuffix<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; -&gt; ^(<b>ebnfSuffix</b> ^(BLOCK[&quot;BLOCK&quot;] ^(ALT[&quot;ALT&quot;] rewrite_tree EOA[&quot;EOA&quot;]) EOB[&quot;EOB&quot;]))<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; -&gt; rewrite_tree<br>

&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; )<br>&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp; rewrite_tree_ebnf<br>&nbsp;&nbsp;&nbsp; ;</i><br><br><br>The 3rd alternative did not include the ebnfSuffix in the tree. It seems nothing needs to be changed in ANTLRv3Tree.g but I don&#39;t fully understand the transition of rewrite_tree_element from ANTLRv3.g to ANTLRv3Tree.g so I could be mistaken here.<br>
<font color="#888888">
<br>Jens</font><div><div></div><div class="Wj3C7c"><br><br><div class="gmail_quote">2008/7/8 Jens Boeykens &lt;<a href="mailto:jens.boeykens@gmail.com" target="_blank">jens.boeykens@gmail.com</a>&gt;:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

Another detail for rule rewrite_tree_atom that I am not sure if it is correct:<br><br>In ANTLRv3.g : &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^(TOKEN_REF ARG_ACTION?)<br>In ANTLRv3Tree.g:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ^(TOKEN_REF ARG_ACTION)<br><br>The question mark dissapeared.&nbsp; I added&nbsp; it&nbsp; in my code, but&nbsp; not sure if it is necessary...<br>


<br>Another thing I did not understand very well (probably my own fault ;) ) :<br>There is a rule called &quot;rewrite_template_block&quot; which is defined, but no other rule seems to be using it. Does this make the rule obsolete? I noticed this because I have not yet encountered a testcase where the rule was used, so I am not sure wether I should write more tests or the rule is indeed obsolete.<br>


<br>Kind regards<br><br><div class="gmail_quote">2008/7/8 Jens Boeykens &lt;<a href="mailto:jens.boeykens@gmail.com" target="_blank">jens.boeykens@gmail.com</a>&gt;:<div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">


Thanks it worked!!<br><br>I&#39;ve encounterd another issue with ANTLRv3.g but it&#39;s not a very important one. When you end your grammar with a single line comment like<br><br>// this is my comment&lt;eof&gt;<br><br>thus no &#39;\n&#39; at the end but directly end of file, the parser will complain it is looking for a &#39;\n&#39;.<br>



<br>Jens<br><br><div class="gmail_quote">2008/7/7 Terence Parr &lt;<a href="mailto:parrt@cs.usfca.edu" target="_blank">parrt@cs.usfca.edu</a>&gt;:<div><div></div><div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



<div><br>
On Jul 7, 2008, at 2:23 PM, Jens Boeykens wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
block(blok, optionsSpec, alternative, rewrite, eob) ::= &lt;&lt;<br>
&lt;alternative,rewrite: {alt,rw | &lt;alt&gt; &lt;rw&gt; | }&gt;<br>
&gt;&gt;<br>
<br>
I have one &#39;|&#39; too many in my output:<br>
r: a -&gt; int | b -&gt; char |;<br>
</blockquote>
<br>
Use &lt;...; separator=&quot;|&quot;&gt;<br>
</blockquote>
<br>
Sorry I can&#39;t find the exact syntax to use here. Remember I need 2 lists here.<br>
&lt;alternative,rewrite; separator=&quot; | &quot;&gt; &nbsp;and &lt;alternative rewrite; separator=&quot; | &quot;&gt; give errors...<br>
</blockquote>
<br></div>
Oh, sorry.<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">



<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&lt;alternative,rewrite: {alt,rw | &lt;alt&gt; &lt;rw&gt;}; separator=&quot;|&quot;&gt;<br>
</blockquote></blockquote></blockquote>
<br>
Should work<br>
Ter<br>
</blockquote></div></div></div><br>
</blockquote></div></div></div><br>
</blockquote></div><br>
</div></div></blockquote></div><br>