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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Backhouse, R.: Program Construction: Calculating Implementations from Specifications. John Wiley, Chichester (2003)
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)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 2nd edn. Addison-Wesley, Reading (2000)
Harrison, W.: Modular Compilers and Their Correctness Proofs. PhD thesis, University of Illinois (2001)
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)
McBride, C.: Personal communication (2003)
Meijer, E.: Calculating Compilers. PhD thesis, Nijmegen University (1992)
Milner, R., Tofte, M., Harper, R., MacQueen, D.: The Definition of Standard ML (Revised). MIT Press, Cambridge (1997)
Moggi, E.: An Abstract View of Programming Languages. Technical Report ECSLFCS- 90-113, Laboratory for Foundations of Computer Science, University of Edinburgh (1990)
Nipkow, T.: Personal communication (2004)
Peyton Jones, S.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)
Peyton Jones, S., Launchbury, J.: State in Haskell. University of Glasgow (1994)
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)
Schmidt, D.A.: Denotational Semantics: A Methodology for Language Development. Allyn and Bacon, Inc. (1986)
Spivey, M.: A Functional Theory of Exceptions. Science of Computer Programming 14(1), 25–43 (1990)
Stroustrup, B.: The C++ Programming Language, 3rd edn. Addison-Wesley, Reading (1997)
Wadler, P.: The Essence of Functional Programming. In: Proc. Principles of Programming Languages (1992)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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