[antlr-interest] How can I maintain the order in the tree?
Jim Idle
jimi at temporal-wave.com
Wed Mar 18 10:48:33 PDT 2009
Gabriel Petrovay wrote:
> Hi all,
>
> Take this example:
>
> tokens {
> Parent;
> }
>
> parent : (childA | childB | childC)*
> -> ^(Parent childA* childB* childC*)
> ;
>
> if I provide as input:
> childB childC childA childB
>
> the tree will order them as defined in the rule and return the
> following tree:
> ^(Parent childA childB childB childC)
>
> How can I define a tree that maintains this order?
> e.g. I want to get: ^(Parent childB childC childA childB)
parent : children* -> ^(Parent children*);
children : childA | childB | childC;
Jim
More information about the antlr-interest
mailing list