Multi-Stage Programming : Axiomatization and Type

Multi-staged programming provides a new paradigm for constructing eecient solutions to complex problems. Techniques such as program generation, multi-level partial evaluation, and run-time code generation respond to the need for general purpose solutions which do not pay run-time interpretive overheads. This paper provides a foundation for the formal analysis of one such system. We introduce a multi-stage language and present its axiomatic, reduction, and natural semantics. Our axiomatic semantics is an extension of the call-by-value-calculus with staging constructs. We demonstrate the soundness of the axiomatic semantics with respect to the natural semantics. We show that staged-languages can \go Wrong" in new ways, and devise a type system that screens out such programs. Finally, we present a proof of the soundness of this type system with respect to the reduction semantics, and show how to extend this result to the natural semantics.

[1]  Walid Taha,et al.  Multi-stage programming with explicit annotations , 1997, PEPM.

[2]  Calton Pu,et al.  Microlanguages for Operating System Specialization , 1997 .

[3]  Robert Glück,et al.  Efficient Multi-level Generating Extensions for Program Specialization , 1995, PLILP.

[4]  Dawson R. Engler,et al.  C: a language for high-level, efficient, and machine-independent dynamic code generation , 1995, POPL '96.

[5]  Eugenio Moggi,et al.  A categorical account of two-level languages , 1997, MFPS.

[6]  Peter Lee Realistic compiler generation , 1989, Foundations of Computing Series.

[7]  Simon L. Peyton Jones,et al.  Dynamic typing as staged type inference , 1998, POPL '98.

[8]  Peter Lee,et al.  Optimizing ML with run-time code generation , 1996, SIGP.

[9]  Robert Glück,et al.  An Automatic Program Generator for Multi-Level Specialization , 1997, LISP Symb. Comput..

[10]  Rowan Davies,et al.  A temporal-logic approach to binding-time analysis , 1995, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[11]  Henk Barendregt,et al.  The Lambda Calculus: Its Syntax and Semantics , 1985 .

[12]  Frank Pfenning,et al.  A modal analysis of staged computation , 1996, POPL '96.

[13]  Robert Glück,et al.  Fast Binding-Time Analysis for Multi-Level Specialization , 1996, Ershov Memorial Conference.

[14]  Don S. Batory,et al.  Composition Validation and Subjectivity in GenVoca Generators , 1997, IEEE Trans. Software Eng..

[15]  Calton Pu,et al.  A Study of Dynamic Optimization Techniques: Lessons and Directions in Kernel Design , 1993 .

[16]  Dawson R. Engler,et al.  VCODE: a retargetable, extensible, very fast dynamic code generation system , 1996, PLDI '96.

[17]  Annotation-directed run-time specialization in C , 1997 .

[18]  Matthias Felleisen,et al.  A Syntactic Approach to Type Soundness , 1994, Inf. Comput..

[19]  Simon L. Peyton Jones,et al.  State in Haskell , 1995, LISP Symb. Comput..

[20]  Charles Consel,et al.  A general approach for run-time specialization and its application to C , 1996, POPL '96.