| | |
Summary: Safe---A Semantic Technique for Transforming
Programs in the Presence of Errors
ALEXANDER AIKEN
University of California, Berkeley
and
JOHN H. WILLIAMS and EDWARD L. WIMMERS
IBM Almaden Research Center
Language designers and implementors have avoided specifying and preserving the meaning of
programs that produce errors. This is apparently because being forced to preserve error behavior
severely limits the scope of program optimization, even for correct programs. However, preserving
error behavior is desirable for debugging, and error behavior must be preserved in any language
that permits usergenerated errors (i.e., exceptions).
This paper presents a technique for expressing general program transformations for languages
that possess a rich collection of distinguishable error values. This is accomplished by defining a
higherorder function called ``Safe'', which can be used to annotate those portions of a program
that are guaranteed not to produce errors. It is shown that this facilitates the expression of very
general program transformations, effectively giving program transformations in a language with
many error values the same power and generality as program transformations in a language with
only a single error value.
Using the semantic properties of Safe, it is possible to provide some useful sufficient conditions
|