Need to build a tree buttom-up (parse tree)

From: Helmut Giese (hgiese_at_ratiosoft.com)
Date: 06/30/04


Date: Wed, 30 Jun 2004 17:35:16 GMT

Hello out there,
continuing my adventures with "Parsing C" :) I need to build a parse
tree. Now these trees are built "buttom-up": for an expression like
        8 + 7 * 5
one would build a tree like
  +
  /\
8 *
    /\
  7 5
that is, starting at the simplest components and building up more
complex structures.

Now I would love to use struct::tree from tcllib, but I don't see a
way to use it in this context. Seems to me, there you start out with a
root node - thus building the tree "top-down".
Q 1) Is there a way to use struct::tree for what I need here?
Q 2) if { !$Q1 } {any other way?}
Thanks for any pointers
Helmut Giese


Quantcast