A generic framework for specialization (abridged version)

  • Peter Thiemann
Regular Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1381)


We present a generic framework for specifying and implementing offline partial evaluators. The framework provides the infrastructure for specializing higher-order programs with computational effects specified through a monad. It performs sound specialization for all monadic instances and is evaluation-order independent. It subsumes most previously published partial evaluators for higher-order functional programming languages in the sense that they are instances of the generic framework with respect to a particular monad.


higher-order programming program transformation partial evaluation computational effects 


  1. 1.
    Lars Ole Andersen. Program Analysis and Specialization for the C Programming Language. PhD thesis, DIKU, University of Copenhagen, May 1994. (DIKU report 94/19).Google Scholar
  2. 2.
    Lars Birkedal and Morten Welinder. Partial evaluation of Standard ML. Rapport 93/22, DIKU, University of Copenhagen, 1993.Google Scholar
  3. 3.
    Anders Bondorf. Automatic autoprojection of higher order recursive equations. Science of Programming, 17:3–34, 1991.MATHCrossRefGoogle Scholar
  4. 4.
    Anders Bondorf. Improving binding times without explicit CPS-conversion. In Proc. 1992 ACM Conference on Lisp and Functional Programming, pages 1–10, San Francisco, California, USA, June 1992.Google Scholar
  5. 5.
    Anders Bondorf and Olivier Danvy. Automatic autoprojection of recursive equations with global variables and abstract data types. Science of Programming, 16(2):151–195, 1991.CrossRefMATHGoogle Scholar
  6. 6.
    Anders Bondorf and Jesper JØrgensen. Efficient analysis for realistic off-line partial evaluation. Journal of Functional Programming, 3(3):315–346, July 1993.CrossRefGoogle Scholar
  7. 7.
    Mikhail A. Bulyonkov and Dmitrij V. Kochetov. Practical aspects of specialization of Algol-like programs. In Danvy et al. [15]., pages 17–32.Google Scholar
  8. 8.
    Charles Consel. Polyvariant binding-time analysis for applicative languages. In David Schmidt, editor, Proc. ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation PEPM'93, pages 66–77, Copenhagen, Denmark, June 1993. ACM Press.Google Scholar
  9. 9.
    Charles Consel and Olivier Danvy. For a better support of static data flow. In John Hughes, editor, Proc. Functional Programming Languages and Computer Architecture 1991, volume 523 of Lecture Notes in Computer Science, pages 496–519, Cambridge, MA, 1991. Springer-Verlag.Google Scholar
  10. 10.
    Charles Consel and Olivier Danvy. Tutorial notes on partial evaluation. In POPL1993 [33], pages 493–501.Google Scholar
  11. 11.
    Charles Consel, Luke Hornof, FranÇois NoËl, Jacques Noyé, and Nicolae Volanschi. A uniform approach for compile-time and run-time specialization. In Danvy et al. [15], pages 54–72.Google Scholar
  12. 12.
    Charles Consel and Francois NoËl. A general approach for run-time specialization and its application to C. In Proc. 23rd Annual ACM Symposium on Principles of Programming Languages, pages 145–156, St. Petersburg, Fla., January 1996. ACM Press.Google Scholar
  13. 13.
    Olivier Danvy. Back to direct style. Science of Programming, 22:183–195, 1994.MATHCrossRefGoogle Scholar
  14. 14.
    Olivier Danvy and Andrzej Filinski. Abstracting control. In LFP 1990 [27], pages 151–160.Google Scholar
  15. 15.
    Olivier Danvy, Robert Glück, and Peter Thiemann, editors. Dagstuhl Seminar on Partial Evaluation 1996, volume 1110 of Lecture Notes in Computer Science, Schloß Dagstuhl, Germany, February 1996. Springer-Verlag.Google Scholar
  16. 16.
    Dirk Dussart, John Hughes, and Peter Thiemann. Type specialisation for imperative languages. In Mads Tofte, editor, Proc. International Conference on Functional Programming 1997, pages 204–216, Amsterdam, The Netherlands, June 1997. ACM Press, New York.Google Scholar
  17. 17.
    Dirk Dussart and Peter Thiemann. Partial evaluation for higher-order languages with state. Berichte des Wilhelm-Schickard-Instituts WSI-97-XX, Universität Tübingen, April 1997.Google Scholar
  18. 18.
    David Espinosa. Building interpreters by transforming stratified monads. ftp://altdorf.ai.mit.edu/pub/dae, June 1994.Google Scholar
  19. 19.
    Carsten K. Gomard and Neil D. Jones. Compiler generation by partial evaluation: A case study. Structured Programming, 12:123–144, 1991.Google Scholar
  20. 20.
    John Hatcliff and Olivier Danvy. A generic account of continuation-passing styles. In Proc. 21st Annual ACM Symposium on Principles of Programming Languages, pages 458–471, Portland, OG, January 1994. ACM Press.Google Scholar
  21. 21.
    John Hatcliff and Olivier Danvy. A computational formalization for partial evaluation. Mathematical Structures in Computer Science, 7(5):507–542, 1997.MathSciNetCrossRefMATHGoogle Scholar
  22. 22.
    G. F. Johnson and Dominic Duggan. Stores and partial continuations as first-class objects in a language and its environment. In Proc. 15th Annual ACM Symposium on Principles of Programming Languages, pages 158–168, San Diego, California, January 1988. ACM Press.Google Scholar
  23. 23.
    Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice-Hall, 1993.Google Scholar
  24. 24.
    John Launchbury and Simon L. Peyton Jones. Lazy functional state threads. In Proc. of the ACM SIGPLAN'94 Conference on Programming Language Design and Implementation, pages 24–35, Orlando, Fla, USA, June 1994. ACM Press.Google Scholar
  25. 25.
    Julia Lawall and Olivier Danvy. Continuation-based partial evaluation. In Proc. 1994 ACM Conference on Lisp and Functional Programming, pages 227–238, Orlando, Florida, USA, June 1994. ACM Press.Google Scholar
  26. 26.
    Julia Lawall and Peter Thiemann. Sound specialization in the presence of computational effects. In Proc. Theoretical Aspects of Computer Software, volume 1281 of Lecture Notes in Computer Science, pages 165–190, Sendai, Japan, September 1997. Springer-Verlag.Google Scholar
  27. 27.
    Proc. 1990 ACM Conference on Lisp and Functional Programming, Nice, France, 1990. ACM Press.Google Scholar
  28. 28.
    Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In POPL1995 [34], pages 333–343.Google Scholar
  29. 29.
    Karoline Malmkjaer, Nevin Heintze, and Olivier Danvy. ML partial evaluation using set-based analysis. In Record of the 1994 ACM SIGPLAN Workshop on ML and its Applications, number 2265 in INRIA Research Report, pages 112–119, Orlando, Florida, June 1994.Google Scholar
  30. 30.
    Eugenio Moggi. Notions of computations and monads. Information and Computation, 93:55–92, 1991.MATHMathSciNetCrossRefGoogle Scholar
  31. 31.
    Barbara Moura, Charles Consel, and Julia Lawall. Bridging the gap between functional and imperative languages. Publication interne 1027, Irisa, Rennes, France, July 1996.Google Scholar
  32. 32.
    Simon L. Peyton Jones and Philip L. Wadler. Imperative functional programming. In POPL1993 [33], pages 71–84.Google Scholar
  33. 33.
    Proc. 20th Annual ACM Symposium on Principles of Programming Languages, Charleston, South Carolina, January 1993. ACM Press.Google Scholar
  34. 34.
    Proc. 22nd Annual ACM Symposium on Principles of Programming Languages, San Francisco, CA, January 1995. ACM Press.Google Scholar
  35. 35.
    John Riecke. Delimiting the scope of effects. In Arvind, editor, Proc. Functional Programming Languages and Computer Architecture 1993, pages 146–155, Copenhagen, Denmark, June 1993. ACM Press, New York.Google Scholar
  36. 36.
    John Riecke and Ramesh Viswanathan. Isolating side effects in sequential languages. In POPL1995 [34], pages 1–12.Google Scholar
  37. 37.
    Peter Thiemann. Correctness of a region-based binding-time analysis. In Proc. Mathematical Foundations of Programming Semantics, Thirteenth Annual Conference, volume 6 of Electronic Notes in Theoretical Computer Science, page 26, Pittsburgh, PA, March 1997. Carnegie Mellon University, Elsevier Science BV. URL: http://www.elsevier.nl/locate/entcs/volume6.html.Google Scholar
  38. 38.
    Peter Thiemann. A generic framework for specialization. Berichte des Wilhelm-Schickard-Instituts WSI-97-XXX, Universität Tübingen, October 1997.Google Scholar
  39. 39.
    Philip L. Wadler. Comprehending monads. In LFP 1990 [27], pages 61–78.Google Scholar
  40. 40.
    Philip L. Wadler. The essence of functional programming. In Proc. 19th Annual ACM Symposium on Principles of Programming Languages, pages 1–14, Albuquerque, New Mexico, January 1992. ACM Press.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1998

Authors and Affiliations

  • Peter Thiemann
    • 1
  1. 1.Universität TübingenGermany

Personalised recommendations