Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to main content

Mix: A self-applicable partial evaluator for experiments in compiler generation

  • Published:
LISP and Symbolic Computation

Abstract

The program transformation principle called partial evaluation has interesting applications in compilation and compiler generation. Self-applicable partial evaluators may be used for transforming interpreters into corresponding compilers and even for the generation of compiler generators. This is useful because interpreters are significantly easier to write than compilers, but run much slower than compiled code. A major difficulty in writing compilers (and compiler generators) is the thinking in terms of distinct binding times: run time and compile time (and compiler generation time). The paper gives an introduction to partial evaluation and describes a fully automatic though experimental partial evaluator, called mix, able to generate stand-alone compilers as well as a compiler generator. Mix partially evaluates programs written in Mixwell, essentially a first-order subset of statically scoped pure Lisp. For compiler generation purposes it is necessary that the partial evaluator be self-applicable. Even though the potential utility of a self-applicable partial evaluator has been recognized since 1971, a 1984 version of mix appears to be the first successful implementation. The overall structure of mix and the basic ideas behind its way of working are sketched. Finally, some results of using a version of mix are reported.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A. V., Sethi, R., and J. D. Ullman,Compilers: Principles, Techniques and Tools, Addison-Wesley, Reading, Massachusetts, 1986.

    Google Scholar 

  2. Beckman, L., Haraldsson, A., Oskarsson,:O., and Sandewall, E. A partial evaluator, and its use as a programming tool.Artificial Intelligence 7, 4 (1976), 319–357.

    Google Scholar 

  3. Bjørner, D., Ershov, A. P., and Jones, N. D. (Eds.).Partial Evaluation and Mixed Computation, Gl. Avernæs, Denmark, 1987. North-Holland, Amsterdam, 1988 (to appear).

    Google Scholar 

  4. Bondorf, A. Towards a self-applicable partial evaluator for term rewriting systems. In [3].

    Google Scholar 

  5. Bulyonkov, M. A. Polyvariant mixed computation for analyzer programs.Acta Informatica 21 (1984), 473–484.

    Google Scholar 

  6. Bulyonkov, M. A. A theoretical approach to polyvariant mixed computation. In [3].

    Google Scholar 

  7. Burstall, R. M., and Darlington, J. A transformational system for developing recursive programs.Journal of the ACM 24 (1977), 44–67.

    Google Scholar 

  8. Christiansen, H., and Jones, N. D. Control flow treatment in a simple semantics-directed compiler generator.Proc IFIP WG 2.2: Formal Description of Programming Concepts II (D. Bjørner, Ed.), North-Holland, Amsterdam, 1983, pp. 73–99.

    Google Scholar 

  9. Codish, M., and Shapiro, E. Compiling or-parallelism into and-parallelism. Proc. Third International Conference on Logic programming, London, United Kingdom, (E. Shapiro, Ed.),Lecture Notes in Computer Science, Vol. 225, Springer-Verlag, New York, 1986, pp. 283–297.

    Google Scholar 

  10. Consel, C. New insights into partial evaluation: the Schism experiment. ESOP'88, European Symp. on Programming, Nancy, France (H. Ganzinger, Ed.).Lecture Notes in Computer Science, Vol. 300, Springer-Verlag, New York, 1988, pp. 236–246.

    Google Scholar 

  11. Cousot, P., and Cousot, R. Abstract interpretation: a unified lattice model for static analysis of programs by construction or approximation of fixpoints. Proc. Fourth ACM Symp. Principles of Programming Languages, Los Angeles, California 1977, pp. 238–252.

  12. Dybkjær, H. Parsers and partial evaluation: An experiment. DIKU student report No. 85-7-15, University of Copenhagen, Denmark, 1985.

    Google Scholar 

  13. Emanuelson, P., and Haraldsson, A. On compiling embedded languages in Lisp. Proc. 1980 Lisp Conference, Stanford, California, 1980, pp. 208–215.

  14. Ershov, A. P. On the essence of compilation.Formal Description of Programming Concepts (E. J. Neuhold, Ed.). North-Holland, Amsterdam, 1978, pp. 391–420.

    Google Scholar 

  15. Ershov, A. P. Mixed computation: Potential applications and problems for study.Theoretical Computer Science 18 (1982), 41–67.

    Google Scholar 

  16. Fujita, H., and Furukawa, K. A self-applicable partial evaluator and its use in incremental compilation.New Generation Computing 6 (2, 3), (June 1988) (to appear).

  17. Fuller, D. A., and Abramsky, S. Mixed computation of Prolog programs.New Generation Computing 6 (2, 3) (June 1988) (to appear).

  18. Futamura, Y. Partial evaluation of computation process—an approach to a compiler-compiler.Systems, Computers, Controls 2 (5) (1971), 45–50.

    Google Scholar 

  19. Futamura, Y. Partial computation of programs. Proc. RIMS Symp. Software Science and Engineering (E. Goto et al., Eds.).Lecture Notes in Computer Science, Vol. 147, Springer-Verlag, 1983, pp. 1–35.

  20. Gallagher, J. Transforming logic programs by specialising interpreters. ECAI-86, Proc. 7th European Conference on Artificial Intelligence, 1986, pp. 109–122.

  21. Ganzinger, H., and Jones, N. D. (Eds.). Programs as Data Objects, Copenhagen, Denmark.Lecture Notes in Computer Science, Vol. 217. Springer-Verlag, New York, 1986.

    Google Scholar 

  22. Haraldsson, A. A partial evaluator, and its use for compiling iterative statements in Lisp. Proc. Fifth ACM Symp. Principles of Programming Languages, Tucson, Arizona, 1978, pp. 195–202.

  23. Heering, J. Partial evaluation and ω-completeness of algebraic specifications.Theoretical Computer Science 43 (1986), 149–167.

    Google Scholar 

  24. Hoare, C. A. R., and Allison, D. Incomputability.Computing Surveys 4 (3) (1972), 169–178.

    Google Scholar 

  25. Jones, N. D. Automatic program specialization: A re-examination from basic principles. In [3].

    Google Scholar 

  26. Jones, N. D., Sestoft, P., and Søndergaard, H. An experiment in partial evaluation: The generation of a compiler generator. Rewriting Techniques and Applications, Dijon, France (J.-P. Jouannaud, Ed.).Lecture Notes in Computer Science, 202. Springer-Verlag, New York, 1985, pp. 124–140.

    Google Scholar 

  27. Jørring, U., and Scherlis, W. L. Compilers and staging transformations. Proc. Thirteenth ACM Symp. Principles of Programming Languages, St. Petersburg, Florida, 1986, pp. 86–96.

  28. Kahn, K. M. A partial evaluator of Lisp programs written in Prolog. Proc. First Int. Logic Programming Conf., Marseille, France, 1982 (M. Van Caneghem, Ed.), pp. 19–25.

  29. Kahn, K. M., and Carlsson, M. The compilation of Prolog programs without the use of a Prolog compiler. Proc. Int. Conf. Fifth Generation Computer Systems, Tokyo, Japan, 1984, pp. 348–355.

  30. Kleene, S. C.Introduction to Metamathematics, Van Nostrand, New York, 1952.

    Google Scholar 

  31. Komorowski, H. J. A Specification of an Abstract Prolog Machine and its Application to Partial Evaluation.Linköping Studies in Science and Technology Dissertations Vol. 69. University of Linköping, Sweden, 1981.

    Google Scholar 

  32. Kugler, H.-J. (Ed.),Information Processing 86, Proc. IFIP 86 Conf. North-Holland, Amsterdam, 1986.

  33. Lee, P., and Pleban, U. A realistic compiler generator based on high-level semantics. Proc. Fourteenth ACM Symp. Principles of Programming Languages, Munich, FRG, 1987, pp. 284–295.

  34. Lloyd, J. W., and Shepherdson, J. C. Partial evaluation in logic programming, Technical Report CS-87-09, Department of Computer Science, University of Bristol, England, 1987.

    Google Scholar 

  35. Lombardi, L. A. Incremental computation.Advances in Computers Vol. 8, (F. L. Alt and M. Rubinoff, Ed.), Academic, New York, 1967, pp. 247–333.

    Google Scholar 

  36. Lombardi, L. A., and Raphael, B. Lisp as the language for an incremental computer. InThe Programming Language Lisp: Its Operation and Application (E. C. Berkeley and D. G. Bobrow, Eds.). MIT Press, Cambridge, Massachusetts, 1964, pp. 204–219.

    Google Scholar 

  37. Mogensen, T. The Application of Partial Evaluation to Ray-Tracing. Master's thesis, University of Copenhagen, Denmark, 1986.

    Google Scholar 

  38. Mogensen, T. Partially static structures in a self-applicable partial evaluator. In [3].

    Google Scholar 

  39. Mosses, P. D. SIS—Semantics Implementation System, Reference Manual and User Guide, DAIMI Report MD-30, University of Aarhus, Denmark, 1979.

    Google Scholar 

  40. Paulson, L. A semantics-directed compiler generator. Proc. Ninth ACM Symp. Principles of Programming Languages, Albuquerque, New Mexico, 1982, pp. 224–233.

  41. Rogers, H.Theory of Recursive Functions and Effective Computability. McGraw-Hill, New York, 1967.

    Google Scholar 

  42. Romanenko, S. A compiler generator produced by a self-applicable specializer can have a surprisingly natural and understandable structure. In [3].

    Google Scholar 

  43. Safra, S., and Shapiro, E. Meta interpreters for real. In [32] pp. 271–278.

  44. Sestoft, P. The structure of a self-applicable partial evaluator. In [21] pp. 236–256.

    Google Scholar 

  45. Sestoft, P. Automatic call unfolding in a partial evaluator. In [3].

    Google Scholar 

  46. Sestoft, P., and Søndergaard, H. A bibliography on partial evaluation.SIGPLAN Notices 23 (2) (February 1988), 19–27.

    Google Scholar 

  47. Sestoft, P., and Zamulin, A. V. Annotated bibliography on partial evaluation and mixed computation. In [3].

    Google Scholar 

  48. Takeuchi, A., and Furukawa, K. Partial evaluation of Prolog programs and its application to meta programming. In [32] pp. 415–420.

  49. TsNIPIASS.Bazisnyi Refal i yego Realizatsiya na Vychislitelnykh Mashinakh. TsNIPIASS, Gosstroi SSSR, Moscow, 1977.

    Google Scholar 

  50. Turchin, V. F. A supercompiler system based on the language Refal.SIGPLAN Notices 14 (2) (1979), 46–54.

    Google Scholar 

  51. Turchin, V. F., Nirenberg, R. M., and Turchin, D. V. Experiments with a supercompiler. Proc. 1982 ACM Symp. Lisp and Functional Programming, Pittsburgh, Pennsylvania, 1982, pp. 47–55.

  52. Venken, R. A Prolog meta-interpreter for partial evaluation and its application to source to source transformation and query-optimisation.Proc. ECAI-84, Pisa, Italy (T. O'Shea, Ed.), North-Holland, Amsterdam, 1984, pp. 91–100.

    Google Scholar 

  53. Vickers, T. Quokka: A translator generator using denotational semantics.Australian Computer Journal 18 (1) (1986), 9–17.

    Google Scholar 

  54. Wand, M. From interpreter to compiler: A representational derivation. In [21] pp. 306–324.

    Google Scholar 

  55. Warren, D. Implementing Prolog—Compiling Predicate Logic Programs, DAI Research Report 39-40, University of Edinburgh, Scotland, 1977.

    Google Scholar 

  56. Watt, D. A. Executable semantic descriptions.Software—Practice and Experience 16 (1) (1986), 13–43.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

About this article

Cite this article

Jones, N.D., Sestoft, P. & Søndergaard, H. Mix: A self-applicable partial evaluator for experiments in compiler generation. Lisp and Symbolic Computation 2, 9–50 (1989). https://doi.org/10.1007/BF01806312

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01806312

Keywords