New insights into partial evaluation: the SCHISM experiment
This article describes SCHISM: a self-applicable partial evaluator for a first order subset of Scheme. SCHISM takes place in the framework of mixed computation, and is situated along the line of the MIX project at the University of Copenhagen. The goal is automatically to generate compilers from interpreters by self-application and we have done this with an extensible and directly executable first order subset of Scheme.
SCHISM is an open-ended partial evaluator with a syntactic extension mechanism (macro-functions written in full Scheme). Furthermore, the set of primitives is extensible without any modification of the system.
Partial evaluation of functional languages relies on the treatment of function calls. We have chosen to use annotations for driving SCHISM to eliminate a call (unfold it) or to keep it residual (specialize it). They are local to each function rather than to each function call. This solves the problem of multiple calls to the same function with different patterns of static and dynamic arguments. Usually two pitfalls are possible in such a case: either to make all of these calls residual and specialize the function exponentially; or to eliminate the calls systematically and possibly start an infinite unfolding. Both are avoided by the use of a filter expression attached to functions. These filters drive SCHISM.
In this article we first describe our first order Scheme both with its abstract syntax and informally. Then we analyze the possibilities raised by keeping annotations local to each function. Finally we propose a partial solution to the open problem of reusing the store: the idea is to distinguish compile time and run time in the interpreter itself. In the end some conclusions and issues are proposed.
KeywordsProgram transformation applicative languages partial evaluation Scheme SCHISM mixed computation program generation specialization unfolding compiler generation
- Aho, A. V., Sethi, R. and Ullman J. D. Compilers: Principles, Techniques and Tools, Addison-Wesley  Google Scholar
- Bondorf A. Towards a Self-Applicable Partial Evaluator for Term Rewriting Systems, North Holland Publ. proceedings of the Workshop on Partial Evaluation and Mixed Computation, Denmark  Google Scholar
- Consel C., Deutsch A., Dumeur R. and Fekete J-D. Skim Reference Manual, Rapport Technique 86/09 Université de Paris 8, France  Google Scholar
- Diku, University of Copenhagen The Mix System User's Guide Version 3.0 Diku internal report, University of Copenhagen, Denmark  Google Scholar
- Emanuelson, P. and Haraldsson A. On Compiling Embedded Languages in Lisp, Lisp Conference, Standford, California, (208–215)  Google Scholar
- Futamura, Y. Partial Evaluation of Computation Process — an Approach to a Compiler-Compiler, Systems, Computers, Controls 2, 5 (45–50) Google Scholar
- Futamura, Y. Partial Computation of Programs, In E. Goto et al (eds.): RIMS Symposia on Software Science and Engineering, Kyoto, Japan. Lecture Notes in Computer Science 147, 1983, (1–35) Google Scholar
- Gordon, M. J. C. The Denotational Description of Programming Languages, Springer-Verlag  Google Scholar
- Jones, N. D., P. Sestoft, and H. Søndergaard An Experiment in Partial Evaluation: the Generation of a Compiler Generator, Rewriting Techniques and Applications, Dijon, France. Lecture Notes in Computer Science 202, (124–140) Springer-Verlag Google Scholar
- Jones, N. D., P. Sestoft, and H. Søndergaard Mix: a Self-Applicable Partial Evaluator for Experiments in Compiler Generation, Diku Report 87/08, University of Copenhagen, Denmark  Google Scholar
- Kleene, S. C. Introduction to Metamathematics, Van Nostrand  Google Scholar
- Kohlbecker, E. E. Syntactic Extensions in the Programming Language Lisp, PH. D. thesis, Technical Report No 199, Indiana University, Bloomington, Indiana  Google Scholar
- Lombardi, L. A. Incremental Computation, Advances in Computers 8 (ed. F. L. Alt and Rubinoff), Academic Press, (247–333)  Google Scholar
- Rees, J. and W. Clinger (eds.) Revised3 Report on the Algorithmic Language Scheme, SIGPLAN Notices 21, 12, (37–79)  Google Scholar
- Schmidt, D. A. Denotational Semantics: a Methodology for Language Development, Allyn and Bacon, Inc.  Google Scholar
- Sestoft, P. The Structure of a Self-Applicable Partial Evaluator, Diku report 85/11, University of Copenhagen, Denmark. .Google Scholar
- Steele G. L. Jr. Rabbit: a Compiler for Scheme, MIT AIL TR 474, Cambridge, Mass. Google Scholar
- Steele G. L. Jr. Common Lisp, Digital Press  Google Scholar