diff options
| author | Brian Campbell | 2017-09-28 11:34:22 +0100 |
|---|---|---|
| committer | Brian Campbell | 2017-09-28 11:34:22 +0100 |
| commit | 1bd35a0934582ff08be0b99280b8d7080cbca4d1 (patch) | |
| tree | 276e8d13cffdfc9c0ff2771e534795559d86be61 /src/ocaml_backend.ml | |
| parent | b5969ea7ca7de19ea2b96c48b1765e2c51e5d2af (diff) | |
| parent | 381a3967ebd9269082b452669f507787decf28b0 (diff) | |
Merge branch 'experiments' into mono-experiments
Diffstat (limited to 'src/ocaml_backend.ml')
| -rw-r--r-- | src/ocaml_backend.ml | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml index 2509f8ef..1e2c8bc6 100644 --- a/src/ocaml_backend.ml +++ b/src/ocaml_backend.ml @@ -137,6 +137,15 @@ let rec ocaml_exp ctx (E_aux (exp_aux, _) as exp) = separate space [string "let"; ocaml_atomic_lexp ctx lexp; equals; string "ref"; ocaml_atomic_exp ctx exp1; string "in"] ^/^ ocaml_exp ctx exp2 + | E_loop (While, cond, body) -> + let loop_body = + separate space [string "if"; ocaml_atomic_exp ctx cond; + string "then"; parens (ocaml_atomic_exp ctx body ^^ semi ^^ space ^^ string "loop ()"); + string "else ()"] + in + (string "let rec loop () =" ^//^ loop_body) + ^/^ string "in" + ^/^ string "loop ()" | E_lit _ | E_list _ | E_id _ | E_tuple _ -> ocaml_atomic_exp ctx exp | _ -> string ("EXP(" ^ string_of_exp exp ^ ")") and ocaml_letbind ctx (LB_aux (lb_aux, _)) = |
