summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-05-22 14:29:49 +0100
committerAlasdair Armstrong2018-05-22 14:29:49 +0100
commit0096e16fae43a673cb1c9d7ad581874a4020c73f (patch)
treeacb11eda4b4b88a34d4b0f6098bbe90e9fa1b995 /src
parentec4652a740eb998766f8ee60b2fbaafc3d5dd4e4 (diff)
Fix for E_cons not being compiled correctly into OCaml
Diffstat (limited to 'src')
-rw-r--r--src/ast_util.ml2
-rw-r--r--src/ocaml_backend.ml1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/ast_util.ml b/src/ast_util.ml
index 968cb320..2ccf19cc 100644
--- a/src/ast_util.ml
+++ b/src/ast_util.ml
@@ -676,7 +676,7 @@ let rec string_of_exp (E_aux (exp, _)) =
| E_exit exp -> "exit " ^ string_of_exp exp
| E_throw exp -> "throw " ^ string_of_exp exp
| E_cons (x, xs) -> string_of_exp x ^ " :: " ^ string_of_exp xs
- | E_list xs -> "[||" ^ string_of_list ", " string_of_exp xs ^ "||]"
+ | E_list xs -> "[|" ^ string_of_list ", " string_of_exp xs ^ "|]"
| E_record_update (exp, FES_aux (FES_Fexps (fexps, _), _)) ->
"{ " ^ string_of_exp exp ^ " with " ^ string_of_list "; " string_of_fexp fexps ^ " }"
| E_record (FES_aux (FES_Fexps (fexps, _), _)) ->
diff --git a/src/ocaml_backend.ml b/src/ocaml_backend.ml
index 91cd288b..60a34273 100644
--- a/src/ocaml_backend.ml
+++ b/src/ocaml_backend.ml
@@ -287,6 +287,7 @@ let rec ocaml_exp ctx (E_aux (exp_aux, _) as exp) =
(string ("let rec loop " ^ zencode_string (string_of_id id) ^ " =") ^//^ loop_body)
^/^ string "in"
^/^ (string "loop" ^^ space ^^ ocaml_atomic_exp ctx exp_from)
+ | E_cons (x, xs) -> ocaml_exp ctx x ^^ string " :: " ^^ ocaml_exp ctx xs
| _ -> string ("EXP(" ^ string_of_exp exp ^ ")")
and ocaml_letbind ctx (LB_aux (lb_aux, _)) =
match lb_aux with