[antlr-interest] Fwd: Tree construction in Antlr 3

Jose Ventura jose.ventura.roda at gmail.com
Tue Jun 27 02:37:58 PDT 2006


Sorry, it's logic, the rule is

'include' 'var' ID CODIGO -> ^('include' ^('var' ID CODIGO))

Regards
José Ventura

---------- Forwarded message ----------
From: Jose Ventura <jose.ventura.roda at gmail.com>
Date: Jun 27, 2006 10:19 AM
Subject: Tree construction in Antlr 3
To: antlr-interest at antlr.org


 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/4e76d531/attachment-0001.html


More information about the antlr-interest mailing list