summaryrefslogtreecommitdiff
path: root/src/pretty_print_sail.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2017-08-15 13:50:21 +0100
committerAlasdair Armstrong2017-08-15 13:50:21 +0100
commit609a48d32a316fc2cb0578ebe84bc479c729cc66 (patch)
tree97ca05d4097be6ea4711ff03679109c8ad49c04c /src/pretty_print_sail.ml
parentf05423c1947df0432362172ba9cfd00c4b8680c0 (diff)
Added exceptions and try/catch blocks to AST and typechecker in order
to translate exceptions in ASL. See test/typecheck/pass/trycatch.sail.
Diffstat (limited to 'src/pretty_print_sail.ml')
-rw-r--r--src/pretty_print_sail.ml6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/pretty_print_sail.ml b/src/pretty_print_sail.ml
index a63df7ea..bb1d7357 100644
--- a/src/pretty_print_sail.ml
+++ b/src/pretty_print_sail.ml
@@ -277,6 +277,10 @@ let doc_exp, doc_let =
(doc_op equals (atomic_exp e1 ^^ colon ^^ atomic_exp e2) (exp e3)))
| E_list exps ->
squarebarbars (separate_map comma exp exps)
+ | E_try(e,pexps) ->
+ let opening = separate space [string "try"; exp e; string "catch"; lbrace] in
+ let cases = separate_map (break 1) doc_case pexps in
+ surround 2 1 opening cases rbrace
| E_case(e,pexps) ->
let opening = separate space [string "switch"; exp e; lbrace] in
let cases = separate_map (break 1) doc_case pexps in
@@ -287,6 +291,8 @@ let doc_exp, doc_let =
string "constraint" ^^ parens (doc_nexp_constraint nc)
| E_exit e ->
separate space [string "exit"; atomic_exp e;]
+ | E_throw e ->
+ separate space [string "throw"; atomic_exp e;]
| E_return e ->
separate space [string "return"; atomic_exp e;]
| E_assert(c,m) ->