[antlr-interest] Tree construction in Antlr 3

Jose Ventura jose.ventura.roda at gmail.com
Tue Jun 27 01:19:29 PDT 2006


Hi all,

I apologize if this in antlr 3 help, but I haven't found.

I have this rule

         include : 'include' 'var' ID codigo -> ^('include' 'var' ID
codigo);

This rule create the tree:
 level 1-->'include'
level 2-------->'var'
level 2-------->ID
level 2-------->codigo

I want to construct this tree
level 1-->'include'
level 2-------->'var'
level 3---------------->ID
level 3---------------->codigo

If I divide this rule in two I can to make the tree how I want
         include: 'include'^^ var;
         var: 'var'^^ ID codigo;

But, It's possible to make this in one sentence with the form *-> ^(...)*
?


Thanks in advance.
José Ventura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060627/fce804f7/attachment.html


More information about the antlr-interest mailing list