Bootstrapping Compiler Generators from Partial Evaluators

  • Robert Glück
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7162)

Abstract

This paper shows that bootstrapping of compiler generators from program specializers is a viable alternative to the third Futamura projection. To practically validate the technique, a novel partial evaluation-based compiler generator was designed and implemented for a recursive flowchart language. Three-step bootstrapping was found to be faster and to produce the same compiler generator that Gomard and Jones produced two decades ago by double self-application. Compiler-generator bootstrapping has distinct properties that are not present in the classic three Futamura projections, such as the ability to turn a specializer into a compiler generator in one step without self-application. Up to now, the approach of hand-writing compiler generators has only been used to avoid difficulties when specializing strongly-typed languages, not as a first step towards compiler-generator bootstrapping.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abramov, S.M., Glück, R.: Principles of inverse computation and the universal resolving algorithm. In: Mogensen, T.Æ., Schmidt, D.A., Sudborough, I.H. (eds.) The Essence of Computation. LNCS, vol. 2566, pp. 269–295. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Beckman, L., Haraldson, A., Oskarsson, Ö., Sandewall, E.: A partial evaluator and its use as a programming tool. Artificial Intelligence 7, 319–357 (1976)MATHCrossRefGoogle Scholar
  3. 3.
    Bulyonkov, M.A.: Polyvariant mixed computation for analyzer programs. Acta Informatica 21(5), 473–484 (1984)MathSciNetMATHCrossRefGoogle Scholar
  4. 4.
    Christensen, N.H., Glück, R.: Offline partial evaluation can be as accurate as online partial evaluation. ACM TOPLAS 26(1), 191–220 (2004)CrossRefGoogle Scholar
  5. 5.
    Consel, C., Lawall, J.L., Le Meur, A.F.: A tour of Tempo: a program specializer for the C language. Science of Computer Programming 52(1-3), 341–370 (2004)MathSciNetMATHCrossRefGoogle Scholar
  6. 6.
    Ershov, A.P.: On the partial computation principle. Information Processing Letters 6(2), 38–41 (1977)MATHCrossRefGoogle Scholar
  7. 7.
    Ershov, A.P.: Mixed computation in the class of recursive program schemata. Acta Cybernetica 4(1), 19–23 (1978)MathSciNetMATHGoogle Scholar
  8. 8.
    Futamura, Y.: Partial evaluation of computing process – an approach to a compiler-compiler. Systems, Computers, Controls 2(5), 45–50 (1971)Google Scholar
  9. 9.
    Futamura, Y.: Partial computation of programs. In: Goto, E., Furukawa, K., Nakajima, R., Nakata, I., Yonezawa, A. (eds.) RIMS Symposia on Software Science and Engineering. Proceedings. LNCS, vol. 147, pp. 1–35. Springer, Heidelberg (1983)Google Scholar
  10. 10.
    Futamura, Y., Konishi, Z., Glück, R.: Program transformation system based on generalized partial computation. New Generation Computing 20(1), 75–99 (2001)CrossRefGoogle Scholar
  11. 11.
    Glück, R.: Is there a fourth Futamura projection? In: Partial Evaluation and Program Manipulation. Proceedings, pp. 51–60. ACM Press (2009)Google Scholar
  12. 12.
    Glück, R.: An experiment with the fourth Futamura projection. In: Pnueli, A., Virbitskaite, I., Voronkov, A. (eds.) PSI 2009. LNCS, vol. 5947, pp. 135–150. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  13. 13.
    Glück, R.: Self-generating program specializers. Information Processing Letters 110(17), 787–793 (2010)MathSciNetMATHCrossRefGoogle Scholar
  14. 14.
    Glück, R.: A self-applicable online partial evaluator for recursive flowchart languages. Software – Practice and Experience (to appear, 2012)Google Scholar
  15. 15.
    Glück, R., Jørgensen, J.: An automatic program generator for multi-level specialization. Lisp and Symbolic Computation 10(2), 113–158 (1997)CrossRefGoogle Scholar
  16. 16.
    Gomard, C.K., Jones, N.D.: Compiler generation by partial evaluation: a case study. Structured Programming 12(3), 123–144 (1991)MathSciNetGoogle Scholar
  17. 17.
    Hatcliff, J.: An Introduction to Online and Offline Partial Evaluation Using a Simple Flowchart Language. In: Hatcliff, J., Mogensen, T.Æ., Thiemann, P. (eds.) DIKU 1998. LNCS, vol. 1706, pp. 20–82. Springer, Heidelberg (1999)Google Scholar
  18. 18.
    Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall (1993)Google Scholar
  19. 19.
    Jones, N.D., Sestoft, P., Søndergaard, H.: An experiment in partial evaluation: the generation of a compiler generator. In: Jouannaud, J.-P. (ed.) RTA 1985. LNCS, vol. 202, pp. 124–140. Springer, Heidelberg (1985)CrossRefGoogle Scholar
  20. 20.
    Klimov, A.V., Romanenko, S.A.: Metavychislitel’ dlja jazyka Refal. Osnovnye ponjatija i primery. (A metaevaluator for the language Refal. Basic concepts and examples). Preprint 71, Keldysh Institute of Applied Mathematics, Academy of Sciences of the USSR, Moscow (1987) (in Russian)Google Scholar
  21. 21.
    Leuschel, M., Jørgensen, J.: Efficient specialisation in Prolog using the hand-written compiler generator LOGEN. Electronic Notes in Theoretical Computer Science 30(2), 157–162 (2000)CrossRefGoogle Scholar
  22. 22.
    Masterson Jr., K.S.: Compilation for two computers with NELIAC. Communications of the ACM 3(11), 607–611 (1960)MATHCrossRefGoogle Scholar
  23. 23.
    Romanenko, S.A.: A compiler generator produced by a self-applicable specializer can have a surprisingly natural and understandable structure. In: Bjørner, D., Ershov, A.P., Jones, N.D. (eds.) Partial Evaluation and Mixed Computation, pp. 445–463. North-Holland (1988)Google Scholar
  24. 24.
    Sestoft, P.: The structure of a self-applicable partial evaluator. Tech. Rep. 85/11, DIKU, University of Copenhagen, Denmark (1985), extended version of a paper with the same title in LNCS, vol. 217, pp. 236–256 (1986)Google Scholar
  25. 25.
    Sumii, E., Kobayashi, N.: A hybrid approach to online and offline partial evaluation. Higher-Order and Symbolic Computation 14(2-3), 101–142 (2001)MATHCrossRefGoogle Scholar
  26. 26.
    Thiemann, P.: Cogen in six lines. In: ACM International Conference on Functional Programming, pp. 180–189. ACM Press (1996)Google Scholar
  27. 27.
    Turchin, V.F.: Metacomputation: metasystem transitions plus supercompilation. In: Danvy, O., Thiemann, P., Glück, R. (eds.) Partial Evaluation 1996. LNCS, vol. 1110, pp. 481–509. Springer, Heidelberg (1996)CrossRefGoogle Scholar
  28. 28.
    Wilkes, M.V.: An experiment with a self-compiling compiler for a simple list-processing language. Annual Review in Automatic Programming 4, 1–48 (1964)CrossRefGoogle Scholar
  29. 29.
    Yokoyama, T., Glück, R.: A reversible programming language and its invertible self-interpreter. In: Partial Evaluation and Program Manipulation. Proceedings, pp. 144–153. ACM Press (2007)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Robert Glück
    • 1
  1. 1.DIKU, Dept. of Computer ScienceUniversity of CopenhagenDenmark

Personalised recommendations