Matching templates against a tree - any idea?
Amit Patel
amitp at Xenon.Stanford.EDU
Tue Sep 28 16:32:29 EDT 1999
Jon Fernquest <ferni at loxinfo.co.th> wrote:
| Fernando Pereira wrote:
|
| Thanks for making the posting on term rewriting systems.
|
| 1. Do you think it's possible to make a rewriting system extension
| to an existing language like Python or Perl?
|
| Everything seems to be in ML and ML extensions such as
| Isabelle right now. It's so easy to cook up (or integrate
| components into) whole systems in Python
| (or Perl) and since so many people use them in their
| day to day work modules have a greater chance of being used.
ML already has some pattern-matching constructs that can be used to
match subtrees. For example, this tree:
Mul
/ \
Add B
/ \
A 0
can be matched like this:
case(tree) of
Mul(Add(A,Num(0)), B) => ... do something with A and B ...
My guess is that complicated tree matching becomes easier when you
have these simpler tree matching constructs built into the language.
ObPython: Pattern matching is the one ML thing I miss when I'm in Python..
- Amit
More information about the Python-list
mailing list