Abstract
Staging allows a programmer to write domain-specific, custom code generators. Ideally, a programming language for staging provides all necessary features for staging, and at the same time, gives static guarantee for the safety properties of generated code including well typedness and well scopedness. We address this classic problem for the language with control operators, which allow code optimizations in a modular and compact way. Specifically, we design a staged programming language with the expressive control operators shift0 and reset0, which let us express, for instance, multi-layer let-insertion, while keeping the static guarantee of well typedness and well scopedness. For this purpose, we extend our earlier work on refined environment classifiers which were introduced for the staging language with state. We show that our language is expressive enough to express interesting code generation techniques, and that the type system enjoys type soundness. We also mention a type inference algorithm for our language under reasonable restriction.
- Cristiano Calcagno, Eugenio Moggi, and Walid Taha. 2004. ML-Like Inference for Classifiers. In Programming Languages and Systems, 13th European Symposium on Programming, ESOP 2004, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2004, Barcelona, Spain, March 29 - April 2, 2004, Proceedings. 79–93. Google Scholar
Cross Ref
- 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 Scholar
Digital Library
- Rowan Davies. 1996. A Temporal-Logic Approach to Binding-Time Analysis. In Proceedings, 11th Annual IEEE Symposium on Logic in Computer Science, New Brunswick, New Jersey, USA, July 27-30, 1996. 184–195. Google Scholar
Cross Ref
- Rowan Davies and Frank Pfenning. 1996. A Modal Analysis of Staged Computation. In Conference Record of The 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM, New York, NY, USA, 258–270. Google Scholar
Digital Library
- Matthias Felleisen. 1991. On the Expressive Power of Programming Languages. Sci. Comput. Program. 17, 1-3 (1991), 35–75. Google Scholar
Digital Library
- Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2015. Combinators for impure yet hygienic code generation. Sci. Comput. Program. 112 (2015), 120–144. Google Scholar
Digital Library
- Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2015. Combinators for impure yet hygienic code generation. Sci. Comput. Program. 112 (2015), 120–144. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Oleg Kiselyov. 2014. The design and implementation of BER MetaO-Caml. In International Symposium on Functional and Logic Programming. Springer, 86–102. Google Scholar
Cross Ref
- Oleg Kiselyov. 2014. The Design and Implementation of BER MetaO-Caml - System Description. In Functional and Logic Programming - 12th International Symposium, FLOPS 2014, Kanazawa, Japan, June 4-6, 2014. Proceedings. 86–102. Google Scholar
Cross Ref
- Oleg Kiselyov. 2017. Let-insertion as a primitive. (2017). http://okmij. org/ftp/ML/MetaOCaml.html#genletGoogle Scholar
- Oleg Kiselyov, Yukiyoshi Kameyama, and Yuto Sudo. 2016. Refined Environment Classifiers - Type- and Scope-Safe Code Generation with Mutable Cells. In Programming Languages and Systems - 14th Asian Symposium, APLAS 2016, Hanoi, Vietnam, November 21-23, 2016, Proceedings. 271–291. Google Scholar
Cross Ref
- Marek Materzok and Dariusz Biernacki. 2011. Subtyping Delimited Continuations. ICFP 2011 46, 9 (Sept. 2011), 81–93. Google Scholar
Digital Library
- Marek Materzok and Dariusz Biernacki. 2012. A Dynamic Interpretation of the CPS Hierarchy. In APLAS 2012, Ranjit Jhala and Atsushi Igarashi (Eds.). Lecture Notes in Computer Science, Vol. 7705. Springer Berlin Heidelberg, 296–311. Google Scholar
Cross Ref
- Pierre Neron, Andrew P. Tolmach, Eelco Visser, and Guido Wachsmuth. 2015. A Theory of Name Resolution. In Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2015, London, UK, April 11-18, 2015. Proceedings. 205– 231. Google Scholar
Cross Ref
- Tiark Rompf. 2016. Lightweight modular staging (LMS): generate all the things! (keynote). In Proceedings of the 2016 ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences, GPCE 2016, Amsterdam, The Netherlands, October 31 -November 1, 2016. 1. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Walid Taha and Tim Sheard. 2000. MetaML and multi-stage programming with explicit annotations. Theor. Comput. Sci. 248, 1-2 (2000), 211–242. Google Scholar
Digital Library
Index Terms
Staging with control: type-safe multi-stage programming with control operators
Recommendations
Staging with control: type-safe multi-stage programming with control operators
GPCE 2017: Proceedings of the 16th ACM SIGPLAN International Conference on Generative Programming: Concepts and ExperiencesStaging allows a programmer to write domain-specific, custom code generators. Ideally, a programming language for staging provides all necessary features for staging, and at the same time, gives static guarantee for the safety properties of generated ...
Making legacy Fortran code type safe through automated program transformation
AbstractFortran is still widely used in scientific computing, and a very large corpus of legacy as well as new code is written in FORTRAN 77. In general this code is not type safe, so that incorrect programs can compile without errors. In this paper, we ...
CLOP: a multi-stage compiler to seamlessly embed heterogeneous code
GPCE 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Generative Programming: Concepts and ExperiencesHeterogeneous programming complicates software development. We present CLOP, a platform that embeds code targeting heterogeneous compute devices in a convenient and clean way, allowing unobstructed data flow between the host code and the devices, ...







Comments