Term rewriting

Ira Baxter idbaxter at semdesigns.com
Sat Jan 4 14:36:13 CET 2003


Not in Python.  But we have a powerful term rewriting system
supported by strong parsing technology and a large number
of predefined grammars for contemporary languages.
See http://www.semdesigns.com/Products/DMS/DMSToolkit.html.

--
Ira D. Baxter, Ph.D., CTO   512-250-1018
Semantic Designs, Inc.      www.semdesigns.com

"Simon Burton" <simonb at webone.com.au> wrote in message
news:pan.2003.01.04.02.58.36.777265 at webone.com.au...
>
> Has anyone (knowingly) implemented a 'term rewriting' framework in python?
> Perhaps as part of another project?
>
> I am implementing something along these lines for a parser project
> (cdecl.py); have decided to manipulate the parse tree *after* building it,
> rather than trying to do it all at once (too brittle).
>
> So, to keep the tree-transformations separate from the parsing.
> Here is what is going on so far:
>
> class Node(list):
>   " node in the parse tree "
>
> and for each syntactic unit, a class derived (perhaps indirectly) from
Node.
>
> The 'operators' are Nodes, and the 'terms' are Node(list) instances.
> This means that operators are varadic, but still, things like
> distributivity, commutativity, make sense.
>
> Two ideas now.
> CRUDE) each operator has one (or more) appropriate 'act' method(s) that
accept a parent argument.
> FANCY) a whole new class heirarchy of general Node(list) transforms.
> Instances would respond to specified class instances (term types) only.
>
> Well, i'd like to see any relevant code people have.
>
> bye,
>
> Simon Burton.
>






More information about the Python-list mailing list