13th International Conference on Generative Programming: Concepts and Experiences (GPCE), September 15-16, 2014, Västerås, Sweden

Desktop Layout

Language Tools
Compiling a Reflective Language using MetaOCaml
Kenichi Asai
(Ochanomizu University, Japan)
Publisher's Version
Abstract: A 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 programming language research as well as practical applications in dynamic environments. However, efficient implementation of a reflective language is extremely difficult. Under the circumstance where the language semantics can change, a partial evaluator is required for compilation. This paper reports on the experience of using MetaOCaml as a compiler for a reflective language. With staging annotations, MetaOCaml achieves the same effect as using a partial evaluator. Unlike the standard partial evaluator, the run mechanism of MetaOCaml enables us to use the specialized (compiled) code in the current runtime environment. On the other hand, the lack of a binding-time analysis in MetaOCaml prohibits us from compiling a user program under modified compiled semantics.


Time stamp: 2020-02-22T06:41:39+01:00