Download PDF

CW Reports

Publication date: 2008-08-01
Publisher: Department of Computer Science, K.U.Leuven; Leuven, Belgium

Author:

Van Weert, Peter

Abstract:

In this report, we provide a detailed description of the compilation scheme the K.U.Leuven JCHR system uses to compile CHR to efficient Java code. We start from a relatively straightforward adaptation of the traditional CHR compilation scheme for Prolog, and gradually add all its basic optimizations. Next, we show why this compilation scheme is not suited for compilation to an imperative host language such as Java. We therefore introduce a novel compilation scheme from CHR to Java that uses explicit call stack maintenance and trampoline-style compilation to guarantee that executing recursive CHR programs no longer results in call stack overflows. The empirical evaluation of the improved compilation scheme confirms it is mostly superior to the traditional one.