what is the ordering of an AST tree?

stephene at sjsoft.com stephene at sjsoft.com
Sun Feb 29 11:26:30 EST 2004


>In my experience ( not  analysis ;)..yes--it's in the same order. Here's
>the deriver module I ended up with last week, and some unittests which
>demonstrate that, for simple expressions, at least, order is preserved.

Great. I'm really hoping that that holds true for all cases. For now I'll
just deal with the simple expressions.

What I am trying to do then is essentially locate the most recent
assignment that a variable has been given. The way I would assume to do
that would be to traverse up the tree (assuming it is in fact in the order
of the program flow) and search for the closest ASSIGN node that involves
the variable name specified.

The trick is now that I dont know how to traverse up an AST tree. And from
what I've seen its a bit nasty. Any ideas on how to traverse up an AST tree?

Thanks
Stephen Emslie

--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .






More information about the Python-list mailing list