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.
( (:i (? t (x (? i *) (? j *)))) -> (t : (xx (? j *) (? i *))))) (:i (? p right)) -> (p : left) )
(x this (x descends (x to (x the (x right (y 1 2))))))
(xx (xx (xx (xx (xx (y 1 2) left) the) to) descends) this)
treacle.scm in the Treacle distribution