A Rational Deconstruction of Landin's J Operator
Olivier Danvy
December 2006 |
Abstract:
Landin's J operator was the first control operator for
functional languages. It was specified with an extension of the SECD machine,
which was the first abstract machine for functional languages. We present a
family of compositional evaluation functions corresponding to this extension
of the SECD machine, using a series of elementary transformations
(transformation into continuation-passing style (CPS) and
defunctionalization, chiefly) and their left inverses (transformation into
direct style and refunctionalization). To this end, we modernize the SECD
machine into a bisimilar one that operates in lock step with the original one
but that (1) does not use a data stack and (2) uses the caller-save rather
than the callee-save convention for environments. We then characterize the J
operator in terms of CPS and in terms of delimited-control operators in the
CPS hierarchy. As a byproduct, we also present a reduction semantics for
applicative expressions with the J operator, based on Curien's original
calculus of explicit substitutions. This reduction semantics mechanically
corresponds to the modernized version of the SECD machine and to the best of
our knowledge, it provides the first syntactic theory of applicative
expressions with the J operator.
The present work is concluded by a motivated wish to see Landin's name added to the list of co-discoverers of continuations. Methodologically, however, it mainly illustrates the value of Reynolds's defunctionalization and of refunctionalization as well as the expressive power of the CPS hierarchy (a) to account for the first control operator and the first abstract machine for functional languages and (b) to connect them to their successors Available as PostScript, PDF, DVI. |