Partial Evaluator as a Compiler for Reflective Languages

This paper presents an online partial evaluator with a mechanism to handle I/O-type side-e ects using preactions, and reports our experiment of using the partial evaluator as a compiler for the re ective language Black we are designing. Black is a Scheme-based re ective language, which allows user programs to access and modify its metalevel interpreter (or the language semantics) from within the same language framework. Because the semantics may change during computation, it is impossible to compile using a conventional Scheme compiler. To cope with this exibility, we implemented an online partial evaluator, and specialized a Scheme meta-circular interpreter with respect to a modi ed interpreter to obtain an e cient version of the modi ed interpreter. The resulting interpreter turns out to be quite e cient in that it is almost identical to the original Scheme interpreter, except that it correctly re ects the modi cation made by users. In fact, we got more: by supplying a speci c user program, we obtained a compiled program under the modi ed language semantics. ANY OTHER IDENTIFYING INFORMATION OF THIS REPORT DISTRIBUTION STATEMENT First issue 35 copies. SUPPLEMENTARY NOTES REPORT DATE December 13, 1995 TOTAL NO. OF PAGES 14 WRITTEN LANGUAGE English NO. OF REFERENCES 18 DEPARTMENT OF INFORMATION SCIENCE Faculty of Science, University of Tokyo 7-3-1 Hongo, Bunkyo-ku Tokyo, 113 Japan Partial Evaluator as a Compiler for Re ective Languages Kenichi Asai Hidehiko Masuhara Satoshi Matsuoka y Akinori Yonezawa