Modular denotational semantics for compiler construction

  • Sheng Liang
  • Paul Hudak
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 1058)


We show the benefits of applying modular monadic semantics to compiler construction. Modular monadic semantics allows us to define a language with a rich set of features from reusable building blocks, and use program transformation and equational reasoning to improve code. Compared to denotational semantics, reasoning in monadic style offers the added benefits of highly modularized proofs and more widely applicable results. To demonstrate, we present an axiomatization of environments, and use it to prove the correctness of a well-known compilation technique. The monadic approach also facilitates generating code in various target languages with different sets of built-in features.


Source Language Program Transformation Action Semantic Denotational Semantic Standard Semantic 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Andrew W. Appel and Trevor Jim. Continuation-passing, closure-passing style. In ACM Symposium on Principles of Programming Languages, pages 193–302, January 1989.Google Scholar
  2. 2.
    Anders Bondorf and Jens Palsberg. Compiling actions by partial evaluation. In FPCA '93: Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, pages 308–317, New York, June 1993. ACM Press.Google Scholar
  3. 3.
    Deryck F. Brown, Hermano Moura, and David A. Watt. ACTRESS: An action semantics directed compiler generator. In Proceedings of the 4th International Conference on Compiler Construction, Edinburgh, U.K., pages 95–109. Springer-Verlag, 1992. Lecture Notes in Computer Science 641.Google Scholar
  4. 4.
    Pietro Cenciarelli and Eugenio Moggi. A syntactic approach to modularity in denotational semantics. In Category Theory and Computer Science '93, 1993.Google Scholar
  5. 5.
    D. Clément, Joëlle Despeyroux, Thierry Despeyroux, and Gilles Kahn. A simple applicative language: Mini-ML. In Proceedings of the 1986 ACM Symposium on Lisp and Functional Programming, pages 13–27, 1986.Google Scholar
  6. 6.
    Olivier Danvy, Jürgen Koslowski, and Karoline Malmkjær. Compiling monads. Technical Report CIS-92-3, Kansas State University, December 1991.Google Scholar
  7. 7.
    David Espinosa. Modular denotational semantics. Unpublished manuscript, December 1993.Google Scholar
  8. 8.
    John Hatcliff and Olivier Danvy. A generic account of continuation-passing styles. In 21st ACM Symposium on Principles of Programming Languages (POPL '94), Portland, Oregon, pages 458–471, New York, January 1994. ACM Press.Google Scholar
  9. 9.
    Paul Hudak. Mutable abstract datatypes. Research Report YALEU/DCS/RR-914, Yale University Department of Computer Science, December 1992.Google Scholar
  10. 10.
    Paul Hudak, Simon Peyton Jones, and Philip Wadler. Report on the programming language Haskell: a non-strict, purely functional language, version 1.2. Technical Report YALEU/DCS/RR-777, Yale University Department of Computer Science, March 1992. Also in ACM SIGPLAN Notices, Vol. 27(5), May 1992.Google Scholar
  11. 11.
    Mark P. Jones and Luc Duponcheel. Composing monads. Research Report YALEU/DCS/RR-1004, Yale University Department of Computer Science, New Haven, Connecticut, December 1993.Google Scholar
  12. 12.
    Neil D. Jones, Peter Sestoft, and Harald Søndergaard. Mix: a self-applicable partial evaluator for experiments in compiler generation. Lisp and Symbolic Computation, 2:9–50, 1989.CrossRefGoogle Scholar
  13. 13.
    Ulrik Jørring and William Scherlis. Compilers and staging transformations. In Proceedings Thirteenth ACM Symposium on Principles of Programming Languages, St. Petersburg, Florida, pages 86–96, 1986.Google Scholar
  14. 14.
    Richard Kelsey and Paul Hudak. Realistic compilation by program transformation. In ACM Symposium on Principles of Programming Languages, pages 181–192, January 1989.Google Scholar
  15. 15.
    David J. King and Philip Wadler. Combining monads. In John Launchbury and Patrick Sansom, editors, Functional Programming, Glasgow 1992, pages 134–143, New York, 1993. Springer-Verlag.Google Scholar
  16. 16.
    Peter Lee. Realistic Compiler Generation. Foundations of Computing. MIT Press, 1989.Google Scholar
  17. 17.
    Sheng Liang, Paul Hudak, and Mark Jones. Monad transformers and modular interpreters. In 22nd ACM Symposium on Principles of Programming Languages (POPL '95), San Francisco, California, New York, January 1995. ACM Press.Google Scholar
  18. 18.
    Erik Meijer. More advice on proving a compiler correct: Improving a correct compiler. Submitted to Journal of Functional Programming.Google Scholar
  19. 19.
    Eugenio Moggi. An abstract view of programming languages. Technical Report ECS-LFCS-90-113, Laboratory for Foundations of Computer Science, University of Edinburgh, Edinburgh, Scotland, 1990.Google Scholar
  20. 20.
    Peter D. Mosses. A basic abstract semantic algebra. In Gilles Kahn, David B. Mac-Queen, and Gordon D. Plotkin, editors, Semantics of Data Types: International Symposium, pages 87–107. Springer-Verlag, June 1984. LNCS 173.Google Scholar
  21. 21.
    Peter D. Mosses. Action Semantics, volume 26 of Cambridge Tracts in Theoretical Computer Science. Cambridge University Press, 1992.Google Scholar
  22. 22.
    Amr Sabry and Matthias Felleisen. Reasoning about programs in continuation-passing style. In Proceedings of the 1992 ACM Conference on LISP and Functional Programming, pages 288–298. ACM Press, June 1992.Google Scholar
  23. 23.
    Guy L. Steele Jr. Building interpreters by composing monads. In Conference Record of POPL '94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Portland, Oregon, pages 472–492, New York, January 1994. ACM Press.Google Scholar
  24. 24.
    Joseph Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press, 1977.Google Scholar
  25. 25.
    Philip Wadler. The essence of functional programming. In Conference Record of the Nineteenth Annual ACM Symposium on Principles of Programming Languages, Albuquerque, New Mexico, pages 1–14, January 1992.Google Scholar
  26. 26.
    Philip L. Wadler. Comprehending monads. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, 1990.Google Scholar
  27. 27.
    Mitchell Wand. A semantic prototyping system. SIGPLAN Notices, ACM Symposium on Compiler Construction, 19(6):213–221, 1984.Google Scholar
  28. 28.
    Mitchell Wand. A short proof of the lexical addressing algorithm. Information Processing Letters, 35:1–5, June 1990.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1996

Authors and Affiliations

  • Sheng Liang
    • 1
  • Paul Hudak
    • 1
  1. 1.Department of Computer ScienceYale UniversityNew Haven

Personalised recommendations