[antlr-interest] Tree parser eats up DOWN node when navigating optional child node

Gerald Rosenberg gerald at certiv.net
Wed Aug 4 16:16:17 PDT 2010


  As best I understand your questions, the answers are no, no, and no . . .

Given an input "PAB", your given parser will construct an AST  ^( ^( 
PARENT A ) B ) and your given tree grammar will likewise match that.

If you somehow feed the tree grammar an AST ^( PARENT A B) or ^( PARENT 
B ), the rule will fail - both structure and content of the AST must 
match for the tree rule to match.

------ Original Message (Wednesday, August 04, 2010 3:41:21 
PM) From: Junkman ------
Subject: Re: [antlr-interest] Tree parser eats up DOWN node when navigating
optional child node
> Thanks for the replies, Jim&  Gerald.
>
> Your responses and some more testing suggests the following to me:
>
> 1. I cannot nest a tree parser rule ("inner rule") in another rule
> ("outer rule"), and try to have the outer rule match additional nodes in
> the subtree matched by the inner rule.
>
> 2. Consequently, the set of trees generated by rewrite expression does
> not necessarily match the set of trees matched by the same rewrite
> expression in the tree parser.
>
> Am I in the ballpark here?
>
> Jay
>


More information about the antlr-interest mailing list