1

Is there an easy to use software that implements term-rewriting? Or do I need to write my own parser for it?

I am looking for something that will take in a fixed set of user-specified rules and will be able to reduce arbitrary terms under those rules. Is there a standard tool for doing such rewrites?

2 Answers2

2

PLT Redex has support for term rewriting. You'll find that most of the examples are focused on small-step operational semantics for programming languages, but in general the system allows for arbitrary rewriting, including non-determinism. It also has a bunch of nice features, like randomized testing of properties, alpha-equivalence, steppers for visualising/debugging, and excellent graphical output.

If you want higher-order syntax, you might be interested in something like ELPI.

For a super-lightweight prolog-style programming, you might be interested in miniKanren.

Joey Eremondi
  • 29,754
  • 5
  • 64
  • 121
0

The computer language Prolog has a term parser built in, and you can represent re-write rules in Prolog clauses, see

https://www.youtube.com/watch?v=b2Px7cu2a68

Rocky
  • 1
  • 2