lcompilers / lpython

Python compiler
https://lpython.org/
Other
1.5k stars 158 forks source link

Symbolic Conditional Term Rewriting #1908

Open rebcabin opened 1 year ago

rebcabin commented 1 year ago

Conditional Term Rewriting (CTR) is a general methodology in symbolic computing. CTR sets Mathematica apart from being just a Computer-Algebra System (CAS). It is the technology behind metaprogramming and the uniquely powerful macro systems of all Lisp languages.

With CTR and SymPy, we can be a better Mathematica than Mathematica. Without CTR, we will not even be a complete Python. Python is already capable of CTR (https://github.com/lihaoyi/macropy). Also, without CTR, we will never compile any real-world Lisp like Clojure, Common Lisp, or Scheme.

All of our ASR->ASR transformations are CTR in disguise. Let's take off the disguises, implement CTR professionally, elegantly, efficiently, generally; craft ASR for doing ASR->ASR in ASR itself.

This is not a small job, but it might be easier than it seems at first glance because we already have the kernel of the idea, just below the surface.

rebcabin commented 1 year ago

https://tqft.net/web/notes/load.php?name=old/20060601-Mathematica-as-a-rewrite-language

By Bruno Buchberger of Buchberger's algorithm, an efficient implementation of Groebner bases.

rebcabin commented 1 year ago

https://mathematica.stackexchange.com/questions/tagged/term-rewriting