skip to main content
10.1145/1411204.1411206acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
invited-talk

Defunctionalized interpreters for programming languages

Published:20 September 2008Publication History

ABSTRACT

This document illustrates how functional implementations of formal semantics (structural operational semantics, reduction semantics, small-step and big-step abstract machines, natural semantics, and denotational semantics) can be transformed into each other. These transformations were foreshadowed by Reynolds in "Definitional Interpreters for Higher-Order Programming Languages" for functional implementations of denotational semantics, natural semantics, and big-step abstract machines using closure conversion, CPS transformation, and defunctionalization. Over the last few years, the author and his students have further observed that functional implementations of small-step and of big-step abstract machines are related using fusion by fixed-point promotion and that functional implementations of reduction semantics and of small-step abstract machines are related using refocusing and transition compression. It furthermore appears that functional implementations of structural operational semantics and of reduction semantics are related as well, also using CPS transformation and defunctionalization. This further relation provides an element of answer to Felleisen's conjecture that any structural operational semantics can be expressed as a reduction semantics: for deterministic languages, a reduction semantics is a structural operational semantics in continuation style, where the reduction context is a defunctionalized continuation. As the defunctionalized counterpart of the continuation of a one-step reduction function, a reduction context represents the rest of the reduction, just as an evaluation context represents the rest of the evaluation since it is the defunctionalized counterpart of the continuation of an evaluation function.

Skip Supplemental Material Section

Supplemental Material

Video

References

  1. Mads Sig Ager. Partial Evaluation of String Matchers & Constructions of Abstract Machines. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, January 2006.Google ScholarGoogle Scholar
  2. Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. From interpreter to compiler and virtual machine: a functional derivation. Research Report BRICS RS-03-14, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, March 2003.Google ScholarGoogle Scholar
  3. Mads Sig Ager, Dariusz Biernacki, Olivier Danvy, and Jan Midtgaard. A functional correspondence between evaluators and abstract machines. In Dale Miller, editor, Proceedings of the Fifth ACM-SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP'03), pages 8--19, Uppsala, Sweden, August 2003. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Mads Sig Ager, Olivier Danvy, and Jan Midtgaard. A functional correspondence between call-by-need evaluators and lazy abstract machines. Information Processing Letters, 90(5):223--232, 2004. Extended version available as the research report BRICS RS-04-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Mads Sig Ager, Olivier Danvy, and Jan Midtgaard. A functional correspondence between monadic evaluators and abstract machines for languages with computational effects. Theoretical Computer Science, 342(1):149--172, 2005. Extended version available as the research report BRICS RS-04-28. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Brian E. Aydemir, Aaron Bohannon, Matthew Fairbairn, J. Nathan Foster, Benjamin C. Pierce, Peter Sewell, Dimitrios Vytiniotis, Geoffrey Washburn, Stephanie Weirich, and Steve Zdancewic. Mechanized metatheory for the masses: The PoplMark challenge. In Joe Hurd and Thomas F. Melham, editors, Theorem Proving in Higher Order Logics, 18th International Conference, TPHOLs 2005, number 3603 in Lecture Notes in Computer Science, pages 50--65, Oxford, UK, August 2005. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Anindya Banerjee, Nevin Heintze, and Jon G. Riecke. Design and correctness of program transformations based on control-flow analysis. In Naoki Kobayashi and Benjamin C. Pierce, editors, Theoretical Aspects of Computer Software, 4th International Symposium, TACS 2001, number 2215 in Lecture Notes in Computer Science, pages 420--447, Sendai, Japan, October 2001. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Małgorzata Biernacka. A Derivational Approach to the Operational Semantics of Functional Languages. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, January 2006.Google ScholarGoogle Scholar
  9. Małgorzata Biernacka, Dariusz Biernacki, and Olivier Danvy. An operational foundation for delimited continuations in the CPS hierarchy. Logical Methods in Computer Science, 1(2:5):1--39, November 2005. A preliminary version was presented at the Fourth ACM SIGPLAN Workshop on Continuations (CW'04).Google ScholarGoogle Scholar
  10. Małgorzata Biernacka and Olivier Danvy. A concrete framework for environment machines. ACM Transactions on Computational Logic, 9(1):1--30, 2007. Article #6. Extended version available as the research report BRICS RS-06-3. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Małgorzata Biernacka and Olivier Danvy. A syntactic correspondence between context-sensitive calculi and abstract machines. Theoretical Computer Science, 375(1-3):76--108, 2007. Extended version available as the research report BRICS RS-06-18. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Dariusz Biernacki. The Theory and Practice of Programming Languages with Delimited Continuations. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, December 2005.Google ScholarGoogle Scholar
  13. Dariusz Biernacki and Olivier Danvy. From interpreter to logic engine by defunctionalization. In Maurice Bruynooghe, editor, Logic Based Program Synthesis and Transformation, 13th International Symposium, LOPSTR 2003, number 3018 in Lecture Notes in Computer Science, pages 143--159, Uppsala, Sweden, August 2003. Springer-Verlag.Google ScholarGoogle Scholar
  14. John Clements and Matthias Felleisen. A tail-recursive semantics for stack inspection. ACM Transactions on Programming Languages and Systems, 26(6):1029--1052, 2004. A preliminary version was presented at the 12th European Symposium on Programming (ESOP 2003). Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. William Clinger, Daniel P. Friedman, and Mitchell Wand. A scheme for a higher-level semantic algebra. In John Reynolds and Maurice Nivat, editors, Algebraic Methods in Semantics, pages 237--250. Cambridge University Press, 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. William Clinger, Anne H. Hartheimer, and Eric M. Ost. Implementation strategies for first-class continuations. Higher-Order and Symbolic Computation, 12(1):7--45, 1999. A preliminary version was presented at the 1988 ACM Conference on Lisp and Functional Programming. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Pierre-Louis Curien. An abstract framework for environment machines. Theoretical Computer Science, 82:389--402, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Olivier Danvy. Back to direct style. Science of Computer Programming, 22(3):183--195, 1994. A preliminary version was presented at the Fourth European Symposium on Programming (ESOP 1992). Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Olivier Danvy. Formalizing implementation strategies for first-class continuations. In Gert Smolka, editor, Proceedings of the Ninth European Symposium on Programming (ESOP 2000), number 1782 in Lecture Notes in Computer Science, pages 88--103, Berlin, Germany, March 2000. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Olivier Danvy. From reduction-based to reduction-free normalization. In Sergio Antoy and Yoshihito Toyama, editors, Proceedings of the Fourth International Workshop on Reduction Strategies in Rewriting and Programming (WRS'04), volume 124(2) of Electronic Notes in Theoretical Computer Science, pages 79--100, Aachen, Germany, May 2004. Elsevier Science. Invited talk.Google ScholarGoogle Scholar
  21. Olivier Danvy. An Analytical Approach to Program as Data Objects. DSc thesis, Department of Computer Science, University of Aarhus, Aarhus, Denmark, October 2006.Google ScholarGoogle Scholar
  22. Olivier Danvy and Andrzej Filinski. Representing control, a study of the CPS transformation. Mathematical Structures in Computer Science, 2(4):361--391, 1992.Google ScholarGoogle ScholarCross RefCross Ref
  23. Olivier Danvy and Jacob Johannsen. Inter-deriving semantic artifacts for object-oriented programming. In Wilfrid Hodges and Ruy de Queiroz, editors, Proceedings of the 15th Workshop on Logic, Language, Information and Computation (WoLLIC 2008), number 5110 in Lecture Notes in Artificial Intelligence, pages 1--16, Edinburgh, Scotland, July 2008. Springer-Verlag. Invited talk. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Olivier Danvy and Kevin Millikin. Refunctionalization at work. Research Report BRICS RS-08-4, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, August 2007. To appear in Science of Computer Programming, extended version.Google ScholarGoogle Scholar
  25. Olivier Danvy and Kevin Millikin. On the equivalence between small-step and big-step abstract machines: a simple application of lightweight fusion. Information Processing Letters, 106(3):100--109, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Olivier Danvy and Lasse R. Nielsen. Defunctionalization at work. In Harald Søndergaard, editor, Proceedings of the Third International ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP'01), pages 162--174, Firenze, Italy, September 2001. ACM Press. Extended version available as the research report BRICS RS-01-23. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Olivier Danvy and Lasse R. Nielsen. Refocusing in reduction semantics. Research Report BRICS RS-04-26, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, November 2004. A preliminary version appeared in the informal proceedings of the Second International Workshop on Rule-Based Programming (RULE 2001), Electronic Notes in Theoretical Computer Science, Vol. 59.4.Google ScholarGoogle Scholar
  28. Olivier Danvy and Ulrik P. Schultz. Lambda-dropping: Transforming recursive equations into programs with block structure. Theoretical Computer Science, 248(1-2):243--287, 2000. A preliminary version was presented at the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 1997). Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Matthias Felleisen. The Calculi of λ-v-CS Conversion: A Syntactic Theory of Control and State in Imperative Higher-Order Programming Languages. PhD thesis, Computer Science Department, Indiana University, Bloomington, Indiana, August 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Matthias Felleisen and Matthew Flatt. Programming languages and lambda calculi. Unpublished lecture notes available at http://www.ccs.neu.edu/home/matthias/3810-w02/readings.html and last accessed in April 2008, 1989-2001.Google ScholarGoogle Scholar
  31. Matthias Felleisen and Daniel P. Friedman. Control operators, the SECD machine, and the λ-calculus. In Martin Wirsing, editor, Formal Description of Programming Concepts III, pages 193--217. Elsevier Science Publishers B.V. (North-Holland), Amsterdam, 1986.Google ScholarGoogle Scholar
  32. Paul T. Graunke, Robert Bruce Findler, Shriram Krishnamurthi, and Matthias Felleisen. Automatically restructuring programs for the web. In Martin S. Feather and Michael Goedicke, editors, 16th IEEE International Conference on Automated Software Engineering (ASE 2001), pages 211--222, Coronado Island, San Diego, California, USA, November 2001. IEEE Computer Society. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Timothy G. Griffin. A formulae-as-types notion of control. In Paul Hudak, editor, Proceedings of the Seventeenth Annual ACM Symposium on Principles of Programming Languages, pages 47--58, San Francisco, California, January 1990. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Robert Harper, Bruce F. Duba, and David MacQueen. Typing first-class continuations in ML. Journal of Functional Programming, 3(4):465--484, October 1993. A preliminary version was presented at the Eighteenth Annual ACM Symposium on Principles of Programming Languages (POPL 1991). Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Christopher T. Haynes, Daniel P. Friedman, and Mitchell Wand. Continuations and coroutines. In Guy L. Steele Jr., editor, Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming, pages 293--298, Austin, Texas, August 1984. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Robert Hieb, R. Kent Dybvig, and Carl Bruggeman. Representing control in the presence of first-class continuations. In Bernard Lang, editor, Proceedings of the ACM SIGPLAN'90 Conference on Programming Languages Design and Implementation, SIGPLAN Notices, Vol. 25, No 6, pages 66--77, White Plains, New York, June 1990. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Graham Hutton and Joel Wright. What is the meaning of these constant interruptions? Journal of Functional Programming, 17(6):777--792, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Jacob Johannsen. An investigation of Abadi and Cardelli's untyped calculus of objects. Master's thesis, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, June 2008. BRICS research report RS-08-6.Google ScholarGoogle Scholar
  39. Thomas Johnsson. Lambda lifting: Transforming programs to recursive equations. In Jean-Pierre Jouannaud, editor, Functional Programming Languages and Computer Architecture, number 201 in Lecture Notes in Computer Science, pages 190--203, Nancy, France, September 1985. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Gilles Kahn. Natural semantics. In Franz-Josef Brandenburg, Guy Vidal-Naquet, and Martin Wirsing, editors, Proceedings of the 4th Annual Symposium on Theoretical Aspects of Computer Science, number 247 in Lecture Notes in Computer Science, pages 22--39, Passau, Germany, February 1987. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Richard Kelsey, William Clinger, and Jonathan Rees, editors. Revised5 report on the algorithmic language Scheme. Higher-Order and Symbolic Computation, 11(1):7--105, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Jean-Louis Krivine. A call-by-name lambda-calculus machine. Higher-Order and Symbolic Computation, 20(3):199--207, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. George Kuan and David MacQueen. Efficient type inference using ranked type variables. In Claudio Russo and Derek Dreyer, editors, Record of the 1998 ACM SIGPLAN Workshop on ML, pages 3--14, Freiburg, Germany, October 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Jan Midtgaard. Transformation, Analysis, and Interpretation of Higher-Order Procedural Programs. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, June 2007.Google ScholarGoogle Scholar
  45. Kevin Millikin. A Structured Approach to the Transformation, Normalization and Execution of Computer Programs. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, May 2007.Google ScholarGoogle Scholar
  46. Johan Munk. A study of syntactic and semantic artifacts and its application to lambda definability, strong normalization, and weak normalization in the presence of state. Master's thesis, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, May 2007. BRICS research report RS-08-3.Google ScholarGoogle Scholar
  47. Lasse R. Nielsen. A denotational investigation of defunctionalization. Research Report BRICS RS-00-47, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, December 2000.Google ScholarGoogle Scholar
  48. Lasse R. Nielsen. A study of defunctionalization and continuation-passing style. PhD thesis, BRICS PhD School, University of Aarhus, Aarhus, Denmark, July 2001. BRICS DS-01-7.Google ScholarGoogle Scholar
  49. Hanne Riis Nielson and Flemming Nielson. Semantics with Applications, a formal introduction. Wiley Professional Computing. John Wiley and Sons, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  50. Atsushi Ohori and Isao Sasano. Lightweight fusion by fixed point promotion. In Matthias Felleisen, editor, Proceedings of the Thirty-Fourth Annual ACM Symposium on Principles of Programming Languages, SIGPLAN Notices, Vol. 42, No. 1, pages 143--154, New York, NY, USA, January 2007. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. Gordon D. Plotkin. Call-by-name, call-by-value and the λ-calculus. Theoretical Computer Science, 1:125--159, 1975.Google ScholarGoogle Scholar
  52. Gordon D. Plotkin. A structural approach to operational semantics. Technical Report FN-19, DAIMI, Department of Computer Science, University of Aarhus, Aarhus, Denmark, September 1981.Google ScholarGoogle Scholar
  53. François Pottier and Nadji Gauthier. Polymorphic typed defunctionalization and concretization. Higher-Order and Symbolic Computation, 19(1):125--162, 2006. A preliminary version was presented at the Thirty-First Annual ACM Symposium on Principles of Programming Languages (POPL 2004). Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. John C. Reynolds. Definitional interpreters for higher-order programming languages. In Proceedings of 25th ACM National Conference, pages 717--740, Boston, Massachusetts, 1972. Reprinted in Higher-Order and Symbolic Computation 11(4):363--397, 1998, with a foreword {55}. Google ScholarGoogle ScholarDigital LibraryDigital Library
  55. John C. Reynolds. Definitional interpreters revisited. Higher-Order and Symbolic Computation, 11(4):355--361, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Guy L. Steele Jr. Rabbit: A compiler for Scheme. Master's thesis, Artificial Intelligence Laboratory, Massachusetts Institute of Technology, Cambridge, Massachusetts, May 1978. Technical report AI-TR-474. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Joseph E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. The MIT Press, 1977. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Alan Turing. On computable numbers, with an application to the Entscheidungsproblem. Proceedings of the London Mathematical Society, 42(2):230--265, 1936-37. Corrections in Volume 43, pages 544-546, 1937.Google ScholarGoogle Scholar
  59. Philip Wadler. The essence of functional programming (invited talk). In Andrew W. Appel, editor, Proceedings of the Nineteenth Annual ACM Symposium on Principles of Programming Languages, pages 1--14, Albuquerque, New Mexico, January 1992. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  60. Mitchell Wand. Continuation-based program transformation strategies. Journal of the ACM, 27(1):164--180, January 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  61. Mitchell Wand. Deriving target code as a representation of continuation semantics. ACM Transactions on Programming Languages and Systems, 4(3):496--517, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  62. Mitchell Wand. Semantics-directed machine architecture. In Richard DeMillo, editor, Proceedings of the Ninth Annual ACM Symposium on Principles of Programming Languages, pages 234--241. ACM Press, January 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  63. Mitchell Wand. A semantic prototyping system. In Susan L. Graham, editor, Proceedings of the 1984 Symposium on Compiler Construction, SIGPLAN Notices, Vol. 19, No 6, pages 213--221, Montréal, Canada, June 1984. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. Mitchell Wand. From interpreter to compiler: a representational derivation. In Harald Ganzinger and Neil D. Jones, editors, Programs as Data Objects, number 217 in Lecture Notes in Computer Science, pages 306--324, Copenhagen, Denmark, October 1985. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. Glynn Winskel. The Formal Semantics of Programming Languages. Foundation of Computing Series. The MIT Press, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Defunctionalized interpreters for programming languages

            Recommendations

            Comments

            Login options

            Check if you have access through your login credentials or your institution to get full access on this article.

            Sign in

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader
            About Cookies On This Site

            We use cookies to ensure that we give you the best experience on our website.

            Learn more

            Got it!