Compiling Lambda-Expressions Using Continuations and Factorizations

We present a source-level transformation for recursion-removal with several interesting characteristics: 1.(i) the algorithm is simple and provably correct; 2.(ii) the stack utilization regime is chosen by the compiler rather than being fixed by the run-time environment; 3.(iii) the stack is available at the source language level so that further optimizations are possible; 4.(iv) the algorithm arises from ideas in category theory. In addition to its implications for compilers, the transformation algorithm is useful as an implementation technique for advanced LISP-based systems, and one such application is described.

[1]  Robert D. Tennent,et al.  The denotational semantics of programming languages , 1976, CACM.

[2]  John C. Reynolds,et al.  Definitional Interpreters for Higher-Order Programming Languages , 1972, ACM '72.

[3]  A. Church The calculi of lambda-conversion , 1941 .

[4]  Donald E. Knuth,et al.  Structured Programming with go to Statements , 1974, CSUR.

[5]  William H. Harrison A New Strategy for Code Generation—the General-Purpose Optimizing Compiler , 1979, IEEE Transactions on Software Engineering.

[6]  John C. Reynolds Semantics of the Domain of Flow Diagrams , 1977, JACM.

[7]  John B. Johnston,et al.  The contour model of block structured processes , 1971, SIGP.

[8]  Stuart M. Brown,et al.  The categorical imperative , 1948 .

[9]  Daniel P. Friedman,et al.  Functional Combination , 1978, Comput. Lang..

[10]  William A. Wulf,et al.  The Design of an Optimizing Compiler , 1975 .

[11]  Carl Hewitt,et al.  Viewing Control Structures as Patterns of Passing Messages , 1977, Artif. Intell..

[12]  Joel Moses The function of FUNCTION in LISP or why the FUNARG problem should be called the environment problem , 1970, SIGS.

[13]  Daniel P. Friedman,et al.  CONS Should Not Evaluate its Arguments , 1976, ICALP.

[14]  Mitchell Wand,et al.  Final Algebra Semantics and Data Type Extensions , 1979, J. Comput. Syst. Sci..

[15]  Daniel G. Bobrow,et al.  A model and stack implementation of multiple environments , 1973, CACM.

[16]  David B. Loveman,et al.  Program Improvement by Source-to-Source Transformation , 1977, J. ACM.

[17]  Daniel G. Bobrow,et al.  New Programming Languages for Artificial Intelligence Research , 1974, CSUR.

[18]  Daniel P. Friedman,et al.  The little LISPer , 1974 .

[19]  Marvin Minsky,et al.  A framework for representing knowledge , 1974 .

[20]  John C. Reynolds,et al.  On the Relation between Direct and Continuation Semantics , 1974, ICALP.

[21]  S. Maclane,et al.  Categories for the Working Mathematician , 1971 .

[22]  John L. Bruno,et al.  Code Generation for a One-Register Machine , 1976, J. ACM.

[23]  Jeffrey D. Ullman,et al.  The Generation of Optimal Code for Arithmetic Expressions , 1970, JACM.

[24]  William A. Wulf,et al.  HYDRA , 1974, Commun. ACM.

[25]  P. J. Landin The Mechanical Evaluation of Expressions , 1964, Comput. J..

[26]  Stuart C. Shapiro,et al.  Boolean-valued loops , 1975 .

[27]  John McCarthy,et al.  LISP 1.5 Programmer's Manual , 1962 .

[28]  Guy L. Steele,et al.  LAMBDA: The Ultimate Declarative , 1976 .

[29]  Marc A. Auslander,et al.  Systematic recursion removal , 1978, CACM.

[30]  Clark Weissman,et al.  LISP 1.5 primer , 1967 .

[31]  Michael J. Fischer Lambda calculus schemata , 1972 .