Browse > Article

Closed-code-conversion: Transforming Open Code Multi-staged Programs into Closed Ones  

Eo, Hyun-Jun (포항공과대학교 미래기술사업단)
Yi, Kwang-Keun (서울대학교 컴퓨터공학부)
Abstract
We present a transformation which converts open-code multi-staged programs into closed ones. Staged computation, which explicitly divides a computation into separate stages, is a unifying framework for existing program generation systems. Because a multi-staged program generates another program, which can also generate a third program and on, the implementation of a multi-staged language is not straightforward. Dynamic binding of (lexically free) variables in code also makes the implementation of a multi-staged language hard. By converting each code into code of function which takes environment for free variables as its argument and giving an actual environment at the code-composition site, we can transform a open-code program into a closed-code one. Combining with Davies and Pfenning's method, our closed-code-conversion enables the implementation of the unstaged language to be useful for executing multi-staged programs. We also prove the correctness of our conversion: the converted program is equivalent to the original program, and the converted program does not have open code.
Keywords
Multi-staged program; open code; closed-code-conversion;
Citations & Related Records
연도 인용수 순위
  • Reference
1 Oliver Danvy. Type-directed partial evaluation. In Proceedings of the Symposium on Principles of Programming Languages, pages 242-257, ACM, Jan 1996
2 M. Leone and Peter Lee. Optimizing ML with run-time code generation. In Proceedings of the Conference on Programming Language Design and Implementation, pages 137-148. ACM, Jun 1996
3 Rowan Davies and Frank Pfenning. A modal analysis of staged computation. In Proceedings of the Symposium on Principles of Programming Languages, pages 258-270, ACM, Jan 1996
4 Paul A. Steckler and Mitchell Wand. Lightweight closure conversion. ACM Transactions on Programming Languages and Systems, 19(1):48-86, Jan 1997   DOI   ScienceOn
5 Guy L. Steele. Common Lisp the Language, 2nd edition. Digital Press, 1990
6 Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial evaluation and automatic generation. Prentice Hall, 1993
7 Ik-Soon Kim, Kwangkeun Yi, and Cristiano Calcagno. A polymorphic modal type system for Lisp-like multi-staged languages. In Proceedings of the Symposium on Principles of Programming Languages, pages 257-268, ACM, Jan 2006
8 Paul Graham. On Lisp: an advanced technique for Common Lisp. Prentice Hall, 1994
9 Yasuhiko Minamide, Greg Morrisett, and Robert Harper. Typed closure conversion. In Proceedings of the Symposium on Principles of Programming Languages, pages 271-283, ACM, Jan 1996
10 Massimilian Poletto, Wilson C. Hsieh, Dawson R. Engler, and M. Frans Kasshoek. C and tcc: a language and compiler for dynamic code generation. ACM Transactions on Programming Languages and Systems, 21:324-369, Mar 1999   DOI