Exceptions

Outline

Exceptional Motivation

Approaches To Error Handling

Error Return Codes

Error Return Codes

Exceptions

Adding Exceptions to Cool

Adding Exceptions to Cool

Typing Exceptions

Typing Exceptions

Typing Exceptions

Operational Semantics

Operational Semantics of Exceptions

Operational Semantics of Exceptions

Operational Semantics of Exceptions

\[\frac{ \begin{array}{l} so, E, S \vdash e_1 : Exc(v), S_1\\ \end{array}} {so, E, S \vdash e_1 + e_2 : Exc(v), S_1} \]

\[\frac{ \begin{array}{l} so, E, S \vdash e_1 : Norm(Int(n_1)), S_1\\ so, E, S \vdash e_2 : Exc(v), S_2 \end{array}} {so, E, S \vdash e_1 + e_2 : Exc(v), S_2} \]

Operational Semantics of Exceptions

Operational Semantics of Exceptions

Operational Semantics of Exceptions

Operational Semantics of Exceptions Notes

Code Generation for Exceptions

Long Jumps

Implementing Exceptions with Tables

Implementing Exceptions with Tables

Implementing Exceptions with Tables

Summary