Abstract
A reflective language enables us to access, inspect, and/or modify the language semantics from within the same language framework. Although the degree of semantics exposure differs from one language to another, the most powerful approach, referred to as the behavioral reflection, exposes the entire language semantics (or the language interpreter) that defines behavior of user programs for user inspection/modification. In this paper, we deal with the behavioral reflection in the context of a functional language Scheme. In particular, we show how to construct a reflective interpreter where user programs are interpreted by the tower of metacircular interpreters and have the ability to change any parts of the interpreters during execution. Its distinctive feature compared to the previous work is that the metalevel interpreters observed by users are written in direct style. Based on the past attempt of the present author, the current work solves the level-shifting anomaly by defunctionalizing and inspecting the top of the continuation frames. The resulting system enables us to freely go up and down the levels and access/modify the direct-style metalevel interpreter. This is in contrast to the previous system where metalevel interpreters were written in continuation-passing style (CPS) and only CPS functions could be exposed to users for modification.
- Asai, K. "Reflecting on the Metalevel Interpreter Written in Direct Style," Presented at the International Lisp Conference 2003 (ILC 2003), New York City, 12 pages (October 2003).Google Scholar
- Asai, K., S. Matsuoka, and A. Yonezawa "Duplication and Partial Evaluation - For a Better Understanding ofReflective Languages -," Lisp and Symbolic Computation, Vol. 9, Nos. 2/3, pp. 203--241, Kluwer Academic Publishers (May/June 1996). Google Scholar
Digital Library
- Bolz, C. F., A. Cuni, M. Fijalkowski, and A. Rigo "Tracing the Meta-Level: PyPy's Tracing JIT Compiler," Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pp. 18--25 (July 2009). Google Scholar
Digital Library
- Danvy, O., and A. Filinski "Abstracting Control," Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pp. 151--160 (June 1990). Google Scholar
Digital Library
- Danvy, O., and K. Malmkjæ r "Intensions and Extensions in a Reflective Tower," Conference Record of the 1988 ACM Symposium on Lisp and Functional Programming, pp. 327--341 (July 1988). Google Scholar
Digital Library
- Friedman, D. P., and M. Wand "Reification: Reflection without Metaphysics," Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming, pp. 348--355 (August 1984). Google Scholar
Digital Library
- Hutton, G., and E. Meijer "Monadic Parsing in Haskell," Journal of Functional Programming, Vol. 8, No. 4, pp. 437--444, Cambridge University Press (July 1998). Google Scholar
Digital Library
- Jefferson, S., and D. P. Friedman "A Simple Reflective Interpreter," Lisp and Symbolic Computation, Vol. 9, Nos. 2/3, pp. 181--202, Kluwer Academic Publishers (May/June 1996). Google Scholar
Digital Library
- Jones, N. D., C. K. Gomard, and P. Sestoft Partial Evaluation and Automatic Program Generation, New York: Prentice-Hall (1993). Google Scholar
Digital Library
- Kameyama, Y., and M. Hasegawa "A Sound and Complete Axiomatization of Delimited Continuations," Proceedings of the eighth ACM SIGPLAN International Conference on Functional Programming (ICFP'03), pp. 177--188 (August 2003). Google Scholar
Digital Library
- Kiczales, G., J. des Rivières, and D. G. Bobrow The Art of the Metaobject Protocol, Cambridge: MIT Press (1991). Google Scholar
Digital Library
- Kiczales, G., J. Lamping, A. Mendhekar, C. Maeda, C. Videira Lopes, J-M. Loingtier, and J. Irwin "Aspect-Oriented Programming," Proceedings of the European Conference on Object-OrientedProgramming (ECOOP'97), pp. 220--242 (1997).Google Scholar
- Masuhara, H., and A. Yonezawa "Design and Partial Evaluation of Meta-objects for a ConcurrentReflective Language," Proceedings of the European Conference on Object-Oriented Programming (ECOOP'98), LNCS 1445, pp. 418--439 (July 1998). Google Scholar
Digital Library
- Reynolds, J. C. "Definitional Interpreters for Higher-Order Programming Languages," Proceedings of the ACM National Conference, Vol. 2, pp. 717--740, (August 1972), reprinted in Higher-Order and Symbolic Computation, Vol. 11, No. 4, pp. 363--397, Kluwer Academic Publishers (December 1998). Google Scholar
Digital Library
- Smith, B. C. "Reflection and Semantics in Lisp," Conference Record of the 14th Annual ACM Symposium on Principles of Programming Languages, pp. 23--35 (January 1984). Google Scholar
Digital Library
- Verwaest, T., C. Bruni, D. Gurtner, A. Lienhard, and O. Niestrasz "PINOCCHIO: Bringing Reflection to Life with First-Class Interpreters," Proceedings of the ACM International Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA '10), pp. 774--789, (October 2010). Google Scholar
Digital Library
- Wand, M., and D. P. Friedman "The Mystery of the Tower Revealed: A Non-Reflective Description of the Reflective Tower," Conference Record of the 1986 ACM Symposium on Lisp and Functional Programming, pp. 298--307 (August 1986). Google Scholar
Digital Library
Index Terms
Reflection in direct style
Recommendations
Compiling a reflective language using MetaOCaml
GPCE '14A reflective language makes the language semantics open to user programs and allows them to access, extend, and modify it from within the same language framework. Because of its high flexibility and expressiveness, it can be an ideal platform for ...
Reflection in direct style
GPCE '11: Proceedings of the 10th ACM international conference on Generative programming and component engineeringA reflective language enables us to access, inspect, and/or modify the language semantics from within the same language framework. Although the degree of semantics exposure differs from one language to another, the most powerful approach, referred to as ...
Compiling a reflective language using MetaOCaml
GPCE 2014: Proceedings of the 2014 International Conference on Generative Programming: Concepts and ExperiencesA reflective language makes the language semantics open to user programs and allows them to access, extend, and modify it from within the same language framework. Because of its high flexibility and expressiveness, it can be an ideal platform for ...







Comments