Treacle is an experimental compiler-definition language based on context rewriting, an expressive variant of term rewriting that generalizes the forest-rewriting used by its predecessor Arboretuum. In context rewriting, a separation is made between names and variables, and patterns may contain holes inside which subpatterns may match at any depth.
Sample Program
(
(:i (? t (x (? i *) (? j *)))) -> (t : (xx (? j *) (? i *)))))
(:i (? p right)) -> (p : left)
)
Input:
(x this (x descends (x to (x the (x right (y 1 2))))))
Output:
(xx (xx (xx (xx (xx (y 1 2) left) the) to) descends) this)
Computational Class
Programming Paradigms
Documentation
Implementations
-
treacle.scm, an interpreter in Scheme
To run this implementation, you need:
Download
Development
Github: catseye/Treacle
Bitbucket: catseye/treacle
Issue tracker: on github