LISP and Symbolic Computation, 2(1)9-50

Mix: A Self-Applicable Partial Evaluator for Experiments in Compiler Generation

Neil D. Jones, DIKU, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen Ø, Denmark
Peter Sestoft, DIKU, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen Ø, Denmark
Harald Søndergaard, DIKU, University of Copenhagen, Universitetsparken 1, DK-2100 Copenhagen Ø, Denmark

Abstract: The program transformation principle called partial evaluation has interesting applications in compilation and compiler generation. Self-applicable partial evaluators may be used for transforming interpreters into corresponding compilers and even for the generation of compiler generators. This is useful because interpreters are significantly easier to write than compilers, but run much slower than compiled code. A major difficulty in writing compilers (and compiler generators) is the thinking in terms of distinct binding times: run time and compile time (and compiler generation time). The paper gives an introduction to partial evaluation and describes a fully automatic though experimental partial evaluator, called mix, able to generate stand-alone compilers as well as a compiler generator. Mix partially evaluates programs written in Mixwell, essentially a first-order subset of statically scoped pure Lisp. For compiler generation purposes it is necessary that the partial evaluator be self-applicable. Even though the potential utility of a self-applicable partial evaluator has been recognized since 1971, a 1984 version of mix appears to be the first successful implementation. The overall structure of mix and the basic ideas behind its way of working are sketched. Finally, some results of using a version of mix are reported.

[local copy]
[picture of journal cover]

March 2003 - hosc@brics.dk