Hi William,

Depending on where you are when walking, lets say you're on FUNC_DECLR
(which is then the root of the tree). You could do something like:

Tree blockTree = funcDeclrTree.getChildAt(tree.getChildCount()-2) ;

In your case you just need the last child for block.

Martijn

On Sat, Apr 17, 2010 at 6:41 PM, William v Doorn
<[email protected]> wrote:
> Hello all,
>
> I'm writing a simple language where functions is a feature. To do this I
> need to somehow catch the tree of expressions/statements and execute it with
> the parameter(s) when it's needed. However, is it possible to create those
> trees when walking over the AST? Let's say I have this in the tree:
>
> ^(FUNC_DECL type ID formalParams? block)
>
> Is it possible to get the tree of the block? I only found this possible to
> do when building the AST (using $block.tree) but I can't seem to do this
> when walking over the AST.
>
> Thanks,
>
> William van Doorn
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>

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