[antlr-interest] input vs. output ASTs in a tree parser
james_cataldo at agilent.com
james_cataldo at agilent.com
Thu Aug 3 11:49:26 PDT 2006
Hi Folks,
Suppose I have the following very basic tree parser:
> class FooParser extends TreeParser;
>
> options {
> importVocab = Foo;
> buildAST = true;
> }
>
> parent!
> :
> #(PARENT childLabel:child
> {#parent = #childLabel;}
> )
> ;
>
> child!
> :
> #(CHILD barLabel:BAR
> {#child = #barLabel;}
> )
> ;
If I give as input to the parent() method of FooParser a tree of type
> #(PARENT #(CHILD BAR))
does the output of FooPrarser.getAST() return a tree of type
> #(CHILD BAR)
or a tree of type
> #(BAR)
In other words, does #childLabel refer to the input AST parsed by the child subrule or the output AST generated by the child subrule?
Cheers,
Adam Cataldo
More information about the antlr-interest
mailing list