AST Manipulation and Common Subexpression Elimination
logistix at cathoderaymission.net
logistix at cathoderaymission.net
Sat Oct 18 16:05:43 EDT 2003
Robert Kern <kern at ugcs.caltech.edu> wrote in message news:<bmqovv$o2f$1 at naig.caltech.edu>...
> I'm in the middle of writing a scientific program with a number of very, very
> long formulae. You can see a typical one below. What I would like to do is to
> parse this code to yield an AST, identify identical subtrees, replace them in
> the AST with a dummy variable to which I will assign the common subexpression.
>
>
You should probably read about "directed acyclic graphs", or dags.
That term should produce plenty or results on google, although I doubt
there will be anything that's python-based out there.
More information about the Python-list
mailing list