Towards Effectively Eliminating Conditional Rewrite Rules
Traian Florin Şerbănuţă, Grigore Roşu · Illinois Digital Environment for Access to Learning and Scholarship (University of Illinois at Urbana-Champaign) · 2004
Conditional rewrite rules are notorious for being difficult to implement in rewrite engines. This is because, like in the case of function calls in programming language implementations, rewrite engines need to "freeze" the current rewriting environment and to create a new one in which the condition is reduced. Stacking these rewriting environments efficiently can easily become a nontrivial task, which can have a direct impact on the efficiency of rewriting. Continuation-passing-style (CPS) transformations are used as a front-end in many programming languages to transform the programs to compile into a convenient and highly optimizable form, in which functions never need to return their values: they just pass their computed values to the current data-context, which "knows" how to continue the computation.We argue that a similar transformation technique can be applied to conditional rewrite systems, to transform them into computationally equivalent unconditional rewrite systems. In this paper we present the first steps towards such a transformation. No special support is needed from the underlying unconditional rewrite engine, so the presented technique can be used as a front-end to any of the current rewrite engines. Since unconditional rewriting is more amenable to parallelization, our transformation is expected to lead to efficient concurrent implementations of rewriting.