diff options
| author | Alasdair Armstrong | 2017-09-26 17:10:06 +0100 |
|---|---|---|
| committer | Alasdair Armstrong | 2017-09-26 17:10:06 +0100 |
| commit | ced56765ec9324a0e690cbb4e790280d17413f99 (patch) | |
| tree | 18584c77dc93b553b840008774fae4b46a622500 /src/ast_util.ml | |
| parent | 15309c879d2c877953512c401e66a7a48af6df97 (diff) | |
Added while-do and repeat-until loops to sail for translating ASL
Diffstat (limited to 'src/ast_util.ml')
| -rw-r--r-- | src/ast_util.ml | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ast_util.ml b/src/ast_util.ml index 46c79764..048fbb15 100644 --- a/src/ast_util.ml +++ b/src/ast_util.ml @@ -221,6 +221,7 @@ and map_exp_annot_aux f = function | E_tuple xs -> E_tuple (List.map (map_exp_annot f) xs) | E_if (cond, t, e) -> E_if (map_exp_annot f cond, map_exp_annot f t, map_exp_annot f e) | E_for (v, e1, e2, e3, o, e4) -> E_for (v, map_exp_annot f e1, map_exp_annot f e2, map_exp_annot f e3, o, map_exp_annot f e4) + | E_loop (loop_type, e1, e2) -> E_loop (loop_type, map_exp_annot f e1, map_exp_annot f e2) | E_vector exps -> E_vector (List.map (map_exp_annot f) exps) | E_vector_indexed (iexps, opt_default) -> E_vector_indexed (List.map (fun (i, exp) -> (i, map_exp_annot f exp)) iexps, map_opt_default_annot f opt_default) @@ -476,6 +477,8 @@ let rec string_of_exp (E_aux (exp, _)) = ^ " by " ^ string_of_exp u ^ " order " ^ string_of_order ord ^ ") { " ^ string_of_exp body + | E_loop (While, cond, body) -> "while " ^ string_of_exp cond ^ " do " ^ string_of_exp body + | E_loop (Until, cond, body) -> "repeat " ^ string_of_exp body ^ " until " ^ string_of_exp cond | E_assert (test, msg) -> "assert(" ^ string_of_exp test ^ ", " ^ string_of_exp msg ^ ")" | E_exit exp -> "exit " ^ string_of_exp exp | E_throw exp -> "throw " ^ string_of_exp exp |
