[antlr-interest] Removing nil nodes from tree

Todd Nine tnine at apigee.com
Sat Mar 17 10:13:25 PDT 2012

Hi Eric,
  Mostly a problem. They are remnants from the grammar tree where operator precedence has occurred.  Or->and->not->equality operand. 

I've subclassed CommonTree for my nodes, and I'm using the visitor pattern to walk the AST and perform the logic to query our Cassandra indexes and return results.  With the nil nodes present, I have to create my own CommonTreeAdapter as well as a nil class for visitor implementation and traversal. If I can just remove them via an option, I won't have to add this extra code. 

Thanks again for all the help!


On Mar 17, 2012, at 7:48 AM, Eric <researcher0x00 at gmail.com> wrote:

> Hi Todd,
> Are the nil nodes causing you a problem or are they just astetically unpleasing?
> Eric
> On Sat, Mar 17, 2012 at 1:38 AM, Todd Nine <tnine at apigee.com> wrote:
> Hi all,
>  I now have my AST generating node classes for my tree.  However, I have
> one final issue.  nil nodes are included in my tree after parsing is
> complete.  They appear in trees due to operator precedence.  Is it possible
> to remove nil nodes as the tree is generated?
> Thanks,
> Todd
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

More information about the antlr-interest mailing list