Abstract
This paper presents a general implementation framework for reflective languages. It allows us to systematically build reflective languages which have the following favorable properties: (1) user programs are allowed to access and change (parts of) metalevel interpreters, (2) reflective facilities are available at every level, (hence there exists conceptually an infinite tower of interpreters), and (3) the interpreter runs as efficiently as the conventional (directly implemented) metacircular interpreter when reflection is not used. Our scheme is divided into three stages. First, we define interpreters which give the operational semantics of each level, and conceptually construct the infinite tower of these interpreters. They are thenduplicated to obtain directly executed interpreters, while introducing double interpretation to maintain redefinability of interpreters. Finally, partial evaluation is employed to collapse the double interpretation into single interpretation. We illustrate our scheme by implementing a particular reflective language calledBlack in Scheme, but it is general enough to be applied to other reflective languages. The paper gives the complete Scheme implementation of Black and demonstrates some examples. We also show how a system with the delta abstraction introduced by Blond can be constructed in our framework.
Similar content being viewed by others
References
Abelson, H., and G. J. Sussman with J. SussmanStructure and Interpretation of Computer Programs, Cambridge: MIT Press (1985).
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).
des Rivières, J. private communication, (September 1993).
des Rivières, J., and B. C. Smith “The Implementation of Procedurally Reflective Languages,”Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming, pp. 331–347 (August 1984).
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).
Ichisugi, Y., S. Matsuoka, and A. Yonezawa “RbCl: A Reflective Object-Oriented Concurrent Language without a Run-time Kernel,”Proceedings of the International Workshop on Reflection and Meta-Level Architecture, pp. 24–35 (November 1992).
Jefferson, S., and D. P. Friedman “A Simple Reflective Interpreter,”Proceedings of the International Workshop on Reflection and Meta-Level Architecture, pp. 24–35 (November 1992), the extended version also appears in this volume.
Jones, N. D., C. K. Gomard, and P SestoftPartial Evaluation and Automatic Program Generation, New York: Prentice-Hall (1993).
Kiczales G. “Towards a New Model of Abstraction in Software Engineering,”Proceedings of the International Workshop on Reflection and Meta-Level Architecture, pp. 1–11 (November 1992).
Rees, J., and W. ClingerRevised 3 Report on the Algorithmic Language Scheme, SIGPLAN NOTICE, Vol. 21, No. 12, (December 1986).
Simmons II, J. W., S. Jefferson, and D. P. Friedman “Language Extension Via First-class Interpreters,” Indiana University Technical Report No. 362, (September 1992).
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).
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).
Author information
Authors and Affiliations
Rights and permissions
About this article
Cite this article
Asai, K., Matsuoka, S. & Yonezawa, A. Duplication and partial evaluation. Lisp and Symbolic Computation 9, 203–241 (1996). https://doi.org/10.1007/BF01806113
Issue Date:
DOI: https://doi.org/10.1007/BF01806113