[antlr-interest] Using labels in actions of a tree parser

Terence Parr parrt at cs.usfca.edu
Wed Aug 13 14:35:24 PDT 2008


On Aug 13, 2008, at 2:15 PM, Foust wrote:

> Oliver,
>
>> But is there a way to get access to the tree node itself? I tried to
>> use the ".tree" attribute, but it leads to an compile error,  
>> since .tree
>> isn't translated to ".getTree()".
>>
>> So, what can I do to get the tree node?
>
> Although it's counter-intuitive, there is no ".tree" attribute on  
> nodes of a
> tree grammar (only in the parser). See p. 132. Although $t does  
> represent
> your 'term' tree node, only "text", "start", and "st" are defined.

$label.start also works.
Ter


More information about the antlr-interest mailing list