From 0096e16fae43a673cb1c9d7ad581874a4020c73f Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 22 May 2018 14:29:49 +0100 Subject: Fix for E_cons not being compiled correctly into OCaml --- src/ast_util.ml | 2 +- src/ocaml_backend.ml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit v1.2.3