skip to main content
article

Refining semantics for multi-stage programming

Published:23 October 2017Publication History
Skip Abstract Section

Abstract

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.

References

  1. Martín Abadi, Luca Cardelli, Pierre-Louis Curien, and Jean-Jacques Lévy. 1990. Explicit substitutions. In Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '90). ACM, New York, NY, USA, 31-46. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. 2003. A functional correspondence between evaluators and abstract machines. In Proceedings of the 5th ACM SIGPLAN International Conference on Principles and Practice of Declaritive Programming (PPDP '03). ACM, NewYork, NY, USA, 8-19. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Pierre-Louis Curien. 1985. Categorical combinatory logic. In Automata, Languages and Programming: 12th Colloquium, ICALP '85, Wilfried Brauer (Ed.). Lecture Notes in Computer Science, Vol. 194. Springer, Berlin, Heidelberg, 130-139. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Olivier Danvy and Andrzej Filinski. 1990. Abstracting control. In Proceedings of the 1990 ACM Conference on LISP and Functional Programming (LFP '90). ACM, New York, NY, USA, 151-160. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. David Darais, Nicholas Labich, Phúc C. Nguyen, and David Van Horn. 2017. Abstracting definitional interpreters (functional pearl). Proc. ACM Program. Lang. 1, ICFP, Article 12 (Aug. 2017), 25 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Matthias Felleisen, Robert Bruce Findler, and Matthew Flatt. 2009. Semantics Engineering with PLT Redex (1st ed.). The MIT Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Rui Ge. 2016. Refining Semantics for Multi-stage Programming. Master's thesis. University of British Columbia.Google ScholarGoogle Scholar
  8. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Inc., Upper Saddle River, NJ, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2008. Closing the stage: from staged code to typed closures. In Proceedings of the 2008 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM '08). ACM, New York, NY, USA, 147-157. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2009. Shifting the stage: staging with delimited control. In Proceedings of the 2009 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM '09). ACM, New York, NY, USA, 111-120. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Peter J. Landin. 1964. The mechanical evaluation of expressions. Comput. J. 6, 4 (1964), 308-320.Google ScholarGoogle ScholarCross RefCross Ref
  12. Peter J. Landin. 1966. The next 700 programming languages. Commun. ACM 9, 3 (1966), 157-166. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Eugenio Moggi, Walid Taha, Zine El-Abidine Benaissa, and Tim Sheard. 1999. An idealized MetaML: simpler, and more expressive. In Programming Languages and Systems: 8th European Symposium on Programming, ESOP '99, S. Doaitse Swierstra (Ed.). Lecture Notes in Computer Science, Vol. 1576. Springer, Berlin, Heidelberg, 193-207. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Damien Pous and Davide Sangiorgi. 2012. Enhancements of the bisimulation proof method. In Advanced Topics in Bisimulation and Coinduction, Davide Sangiorgi and Jan Rutten (Eds.). Cambridge Tracts in Theoretical Computer Science, Vol. 52. Cambridge University Press, New York, NY, USA, Chapter 6, 233-289.Google ScholarGoogle Scholar
  15. Kristoffer Høgsbro Rose. 1996. Explicit Substitution: Tutorial & Survey. Technical Report. BRICS, Department of Computer Science, University of Aarhus.Google ScholarGoogle Scholar
  16. Davide Sangiorgi. 2011. Introduction to Bisimulation and Coinduction. Cambridge University Press, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Tim Sheard. 1999. Using MetaML: A staged programming language. In Advanced Functional Programming: Third International School, AFP'98, S. Doaitse Swierstra, José N. Oliveira, and Pedro R. Henriques (Eds.). Lecture Notes in Computer Science, Vol. 1608. Springer, Berlin, Heidelberg, 207-239.Google ScholarGoogle Scholar
  18. Tim Sheard. 2001. Accomplishments and research challenges in meta-programming. In Semantics, Applications, and Implementation of Program Generation: Second International Workshop, SAIG 2001 Proceedings, Walid Taha (Ed.). Lecture Notes in Computer Science, Vol. 2196. Springer, Berlin, Heidelberg, 2-44. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Walid Taha. 1999. A sound reduction semantics for untyped CBN multi-stage computation. Or, the theory of MetaML is non-trival. In Proceedings of the 2000 ACM SIGPLAN Workshop on Partial Evaluation and Semantics-based Program Manipulation (PEPM '00). ACM, New York, NY, USA, 34-43. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Walid Taha. 2004. A gentle introduction to multi-stage programming. In Domain-Specific Program Generation: International Seminar, Christian Lengauer, Don Batory, Charles Consel, and Martin Odersky (Eds.). Lecture Notes in Computer Science, Vol. 3016. Springer, Berlin, Heidelberg, 30-50.Google ScholarGoogle ScholarCross RefCross Ref
  21. Walid Taha, Zine-El-Abidine Benaissa, and Tim Sheard. 1998. Multistage programming: axiomatization and type safety. In Automata, Languages and Programming: 25th International Colloquium, ICALP'98 Proceedings, Kim G. Larsen, Sven Skyum, and Glynn Winskel (Eds.). Lecture Notes in Computer Science, Vol. 1443. Springer Berlin Heidelberg, Berlin, Heidelberg, 918-929. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Walid Taha and Michael Florentin Nielsen. 2003. Environment classifiers. In Proceedings of the 30th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL '03). ACM, New York, NY, USA, 26-37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Walid Taha and Tim Sheard. 1997. Multi-stage programming with explicit annotations. In Proceedings of the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM '97). ACM, New York, NY, USA, 203-217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Walid Taha and Tim Sheard. 2000. MetaML and multi-stage programming with explicit annotations. Theoretical Computer Science 248, 1 (2000), 211-242. PEPM'97. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Walid Mohamed Taha. 1999. Multistage Programming: Its Theory and Applications. Ph.D. Dissertation. Oregon Graduate Institute of Science and Technology. https://www.cs.rice.edu/~taha/publications/thesis/thesis.pdfGoogle ScholarGoogle Scholar
  26. David Van Horn and Matthew Might. 2012. Systematic abstraction of abstract machines. Journal of Functional Programming 22, 4-5 (2012), 705-746. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Refining semantics for multi-stage programming

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in

      Full Access

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!