[antlr-interest] Tree weirdness C++ mode

Monty Zukowski monty at codetransform.com
Thu Apr 29 11:29:53 PDT 2004


In a parser with C++ as a target, building a tree the following way 
does not work:

  ##->addChild(#[EMPTY,"empty"]);

Instead I have do to this:

astFactory->addASTChild(currentAST, #[EMPTY,"empty"]);

If I use addChild() then I see that the root node is updated with the 
child but some other bookkeeping must be happening because it gets 
overwritten later.

This contradicts some of the information in here: 
http://wwwhome.cs.utwente.nl/~klaren/antlr/treebuilding.txt

Anybody know what's going on?

Also doing ##=#(##,#[EMPTY,"empty"]); seems to overwrite the first 
child--equivalent to addFirstChild().  I always thought it would be 
equivalent to addChild().  So the following two have different 
behaviors:

astFactory->addASTChild(currentAST, #[EMPTY]);
##=#(##,#[EMPTY,"empty"]);

Does that seem right?  I suspect this might be different from Java.

Discovered in version 2.7.2.  Also present in 2.7.3 and 2.7.4rc1.

Monty



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list