Skip to main content

Compiling Exceptions Correctly

  • Conference paper
Mathematics of Program Construction (MPC 2004)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 3125))

Included in the following conference series:

Abstract

Exceptions are an important feature of modern programming languages, but their compilation has traditionally been viewed as an advanced topic. In this article we show that the basic method of compiling exceptions using stack unwinding can be explained and verified both simply and precisely, using elementary functional programming techniques. In particular, we develop a compiler for a small language with exceptions, together with a proof of its correctness.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Backhouse, R.: Program Construction: Calculating Implementations from Specifications. John Wiley, Chichester (2003)

    Google Scholar 

  2. Claessen, K., Hughes, J.: QuickCheck: A Lightweight Tool for Random Testing of Haskell Programs. In: Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, Montreal, Canada (September 2000)

    Google Scholar 

  3. Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 2nd edn. Addison-Wesley, Reading (2000)

    Google Scholar 

  4. Harrison, W.: Modular Compilers and Their Correctness Proofs. PhD thesis, University of Illinois (2001)

    Google Scholar 

  5. Marlow, S., Peyton Jones, S., Moran, A., Reppy, J.: Asynchronous Exceptions In Haskell. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, Snowbird, Utah (June 2001)

    Google Scholar 

  6. McBride, C.: Personal communication (2003)

    Google Scholar 

  7. Meijer, E.: Calculating Compilers. PhD thesis, Nijmegen University (1992)

    Google Scholar 

  8. Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)

    Google Scholar 

  9. Moggi, E.: An Abstract View of Programming Languages. Technical Report ECSLFCS- 90-113, Laboratory for Foundations of Computer Science, University of Edinburgh (1990)

    Google Scholar 

  10. Nipkow, T.: Personal communication (2004)

    Google Scholar 

  11. Peyton Jones, S.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)

    Google Scholar 

  12. Peyton Jones, S., Launchbury, J.: State in Haskell. University of Glasgow (1994)

    Google Scholar 

  13. Peyton Jones, S., Reid, A., Hoare, T., Marlow, S., Henderson, F.: A Semantics For Imprecise Exceptions. In: Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, Atlanta, Georgia (May 1999)

    Google Scholar 

  14. Schmidt, D.A.: Denotational Semantics: A Methodology for Language Development. Allyn and Bacon, Inc. (1986)

    Google Scholar 

  15. Spivey, M.: A Functional Theory of Exceptions. Science of Computer Programming 14(1), 25–43 (1990)

    Article  MATH  Google Scholar 

  16. Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley, Reading (1997)

    Google Scholar 

  17. Wadler, P.: The Essence of Functional Programming. In: Proc. Principles of Programming Languages (1992)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2004 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Hutton, G., Wright, J. (2004). Compiling Exceptions Correctly. In: Kozen, D. (eds) Mathematics of Program Construction. MPC 2004. Lecture Notes in Computer Science, vol 3125. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-27764-4_12

Download citation

  • DOI: https://doi.org/10.1007/978-3-540-27764-4_12

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-22380-1

  • Online ISBN: 978-3-540-27764-4

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics