Compiling Exceptions Correctly
نویسندگان
چکیده
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.
منابع مشابه
Compiling Exceptions Correctly (Extended Version)
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 lang...
متن کاملCompiling Exceptions Correctly
An exception compilation scheme that dynamically creates and removes exception handler entries on the stack. A formalization of an article of the same name by Hutton and Wright [1]. 1 Compiling exception handling theory Exceptions imports Main begin 1.1 The source language datatype expr = Val int | Add expr expr | Throw | Catch expr expr consts eval :: "expr ⇒ int option" primrec "eval (Val i) ...
متن کاملCompiling and reasoning about exceptions and interrupts
Exceptions and interrupts are important for programming reliable software systems, yet our methods for reasoning about them are weak. In this thesis we explore the problem of compiling and reasoning about exceptions and interrupts in the context of a simple language. We develop the language in three stages, initially without any form of exceptions, then adding exceptions, and finally adding int...
متن کاملCompiling Natural Semantics Into ML
This paper presents a compilation scheme from natural semantics speciications to ML. Permutations of premises allow, for a class of speciications, a purely functional execution and can reduce non-determinism. This method uses some speciic features of ML, like exceptions , closures and pattern-matching.
متن کاملTowards a Cost-Effective Estimation of Uncaught Exceptions in SML Programs
We present a static analysis that detects potential runtime exceptions that are raised and never handled inside Standard ML (SML) programs. This analysis will predict abrupt termination of SML programs , which is SML's only one \safety hole." Even though SML program's control ow and exception ow are in general mutually dependent, analyzing the two ows are safely decoupled. Program's control-ow ...
متن کامل