On Wed, Apr 6, 2011 at 3:
> Hi everyone,
>
> This is my first question on this list and I have been using ANTLR for
> about two weeks.
>
> Lets say I want to parse a simple arithmetic expression. For that I
> create a simple grammar - as shown in many of the available examples -
> and I order ANTLR to generate the AST. Now, is there any simple way to
> change the label of each root node so it reflects the value of their
> children? That is, given
>
> (2+3)*4
>
> I would get the following AST
>
> *
>  4
>  +
>    2
>    3
>
> and I would like to get instead
>
> (2+3)*4
>  4
>  (2+3)
>    2
>    3
>
> Instead of only getting * or + On the root nodes I would like to get a
> label with the full content or information or the children at current
> depth.
>
> Currently, I am thinking doing this using the commontree class. Is
> there anyway of specifying this directly at the grammar? Also, I have
> not succeed in this using rewrite rules....
>
> Regards,
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to