[antlr-interest] Tree Construction for empty while loop

Suman Karumuri mansuk at gmail.com
Sat Nov 5 03:02:52 PST 2005


On 11/3/05, Bryan Ewbank <ewbank at gmail.com> wrote:
> I think it's working as you desire - it's producing a degenerate tree,
> or a root.  In ANTLR, every node is a tree, and parens are used only
> if there are children - they do not represent a level of the tree.
> Turned around, left nodes are not printed with parenthesis.
>
> Since "B" is a leaf node when there are no statements, it is correctly
> reporting "B" rather than "(B)" - just at it's reporting each
> identifier as "name" rather than "(name)".
>
This tricked me. All along i did not realise the importance of
equating a node with a tree. Now i see it.
Thanks bryan. Your comments were very useful.

-Suman


More information about the antlr-interest mailing list