-
Notifications
You must be signed in to change notification settings - Fork 1
/
exceptions.ml
30 lines (27 loc) · 936 Bytes
/
exceptions.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
open Types
(* Very few exceptions are used since most of the time, when an exception would
* occur in a normal execution of the program, we just don't create a successor
* state instead of raising an exception *)
exception NotYetImplemented
exception Malformed of string * Ast.node
exception InvalidKeyword of string
exception UnboundIdentifier of string
exception BadArguments of string
exception UnboundAddress of addr
exception NotAtomic of Ast.node
let string_of_exception = function
| NotYetImplemented ->
"Not yet implemented"
| Malformed (s, n) ->
"Malformed " ^ s ^ ": " ^ (Ast.string_of_node n)
| InvalidKeyword k ->
"Invalid keyword: " ^ k
| UnboundIdentifier s ->
"Unbound identifier: " ^ s
| BadArguments s ->
"Bad arguments: " ^ s
| UnboundAddress a ->
"Unbound address: " ^ (Addr.string_of_address a)
| NotAtomic n ->
"Not atomic: " ^ (Ast.string_of_node n)
| e -> raise e