From 609a48d32a316fc2cb0578ebe84bc479c729cc66 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 15 Aug 2017 13:50:21 +0100 Subject: Added exceptions and try/catch blocks to AST and typechecker in order to translate exceptions in ASL. See test/typecheck/pass/trycatch.sail. --- src/pretty_print_sail.ml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/pretty_print_sail.ml') 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) -> -- cgit v1.2.3