[antlr-interest] Re: Limits of tree generation (C++)

Ric Klaren klaren at cs.utwente.nl
Thu Oct 9 03:43:07 PDT 2003


On Thu, Oct 09, 2003 at 09:58:08AM -0000, marcschellens wrote:
> The next stage of processing that tree knows only to read
> the first node.
> As I understood, the nodes are reference counted.
> Isn't it therefore more effective to keep it like it is,
> or is there a caveeat?

You'll have the same node in the tree in multiple places, usually this will
give problems. E.g. at a later stage you will forget about it maybe switch
to some custom AST with extra info and get bitten by it, or you add a child
to it at a later stage and see it appear in two places. The sky's the limit
as Murphy said...

dupTree is the right thing here I guess (look for it in ASTFactory.hpp) if
you know for sure that there's only one node a simple clone might do the
trick as well.

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     "Evil will always triumph, because Good is dumb." ---  Spaceballs


 

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




More information about the antlr-interest mailing list