Computer Science Department
School of Computer Science, Carnegie Mellon University
Optimized Compilation of Multiset Rewriting with Comprehensions
Edmund S. L. Lam, Iliano Cervesato
Also appears as Qatar Campus Technical Report
We extend the rule-based, multiset rewriting language CHR with multiset comprehension patterns. Multiset comprehension provides the programmer with the ability to write multiset rewriting rules that can match a variable number of entities in the state. This enables implementing algorithms that coordinate large amounts of data or require aggregate operations in a declarative way, and results in code that is more concise and readable than with pure CHR. We call this extension CHRcp. In this paper, we formalize the operational semantics of CHRcp and define a low-level optimizing compilation scheme based on join ordering for the efficient execution of programs. We provide preliminary empirical results that demonstrate the scalability and effectiveness of this approach.