Refining semantics for multi-stage programming

The multi-stage programming paradigm supports runtime code generation and execution. Though powerful, its potential is impeded by the lack of static analysis support. Van Horn and Might proposed a general-purpose approach to systematically develop static analyses by transforming an environmental abstract machine, which evolves a control string, an environment and a continuation as a program evaluates. To the best of our knowledge, no such semantics exists for a multi-stage language like MetaML. We develop and prove correct an environmental abstract machine semantics for MetaML by gradually refining the reference substitutional structural operational semantics. Highlights of our approach include leveraging explicit substitutions to bridge the gap between substitutional and environmental semantics, and devising meta-environments to model the complexities of variable bindings in multi-stage environmental semantics.

[1]  Chung-chieh Shan,et al.  Shifting the stage: staging with delimited control , 2009, PEPM '09.

[2]  Gilles Kahn,et al.  Natural Semantics , 1987, STACS.

[3]  Pierre Castéran,et al.  Interactive Theorem Proving and Program Development , 2004, Texts in Theoretical Computer Science An EATCS Series.

[4]  P. J. Landin,et al.  The next 700 programming languages , 1966, CACM.

[5]  Tim Sheard,et al.  Accomplishments and Research Challenges in Meta-programming , 2001, SAIG.

[6]  Walid Taha,et al.  An Idealized MetaML: Simpler, and More Expressive , 1999, ESOP.

[7]  Walid Taha,et al.  MetaML and multi-stage programming with explicit annotations , 2000, Theor. Comput. Sci..

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

[9]  Peter Sestoft,et al.  Partial evaluation and automatic program generation , 1993, Prentice Hall international series in computer science.

[10]  Matthew Might,et al.  Systematic abstraction of abstract machines , 2011, Journal of Functional Programming.

[11]  Walid Taha,et al.  Environment classifiers , 2003, POPL.

[12]  Geoffrey Mainland,et al.  Explicitly heterogeneous metaprogramming with MetaHaskell , 2012, ICFP.

[13]  Davide Sangiorgi,et al.  Enhancements of the bisimulation proof method , 2012, Advanced Topics in Bisimulation and Coinduction.

[14]  Walid Taha,et al.  A Gentle Introduction to Multi-stage Programming , 2003, Domain-Specific Program Generation.

[15]  Kristoffer H. Rose,et al.  Explicit Substitution - Tutorial & Survey , 1996 .

[16]  Matthias Felleisen,et al.  Semantics Engineering with PLT Redex , 2009 .

[17]  Olivier Danvy,et al.  Abstracting control , 1990, LISP and Functional Programming.

[18]  Pierre-Louis Curien Categorial Combinatory Logic , 1985, ICALP.

[19]  Walid Taha,et al.  A sound reduction semantics for untyped CBN mutli-stage computation. Or, the theory of MetaML is non-trival (extended abstract) , 1999, PEPM '00.

[20]  Walid Taha,et al.  Multi-Stage Programming: Its Theory and Applications , 1999 .

[21]  S. C. Kleene,et al.  Introduction to Metamathematics , 1952 .

[22]  Martín Abadi,et al.  Explicit substitutions , 1989, POPL '90.

[23]  Luca Aceto,et al.  Advanced Topics in Bisimulation and Coinduction , 2012, Cambridge tracts in theoretical computer science.

[24]  Robert Hieb,et al.  The Revised Report on the Syntactic Theories of Sequential Control and State , 1992, Theor. Comput. Sci..

[25]  Ulf Norell,et al.  A Brief Overview of Agda - A Functional Language with Dependent Types , 2009, TPHOLs.

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

[27]  D. Sangiorgi Introduction to Bisimulation and Coinduction , 2011 .

[28]  Olivier Danvy,et al.  A functional correspondence between evaluators and abstract machines , 2003, PPDP '03.

[29]  Tim Sheard Using MetaML: A Staged Programming Language , 1998, Advanced Functional Programming.

[30]  Chung-chieh Shan,et al.  Closing the stage: from staged code to typed closures , 2008, PEPM '08.

[31]  Rui Ge,et al.  Refining semantics for multi-stage programming , 2019, J. Comput. Lang..

[32]  David Darais,et al.  Abstracting definitional interpreters (functional pearl) , 2017, Proc. ACM Program. Lang..

[33]  Walid Taha,et al.  Multi-Stage Programming: Axiomatization and Type Safety , 1998, ICALP.

[34]  Walid Taha,et al.  A Sound Reduction Semantics for Untyped CBN Multi-stage Computation. Or, the Theory of MetaML is Non-trivial (Extended Abstract) , 1999, PEPM.