minor renamings

This commit is contained in:
Galfour 2019-05-15 18:28:25 +00:00
parent 7a5130f51f
commit 1029f42aac
4 changed files with 12 additions and 12 deletions

View File

@ -214,16 +214,16 @@ and translate_expression ?(first=false) (expr:expression) (env:environment) : (m
error title content in
trace error @@
return code
| E_empty_map sd ->
| E_make_empty_map sd ->
let%bind (src, dst) = bind_map_pair Compiler_type.type_ sd in
return @@ i_empty_map src dst
| E_empty_list t ->
| E_make_empty_list t ->
let%bind t' = Compiler_type.type_ t in
return @@ i_nil t'
| E_make_none o ->
let%bind o' = Compiler_type.type_ o in
return @@ i_none o'
| E_Cond (c, a, b) -> (
| E_if_bool (c, a, b) -> (
let%bind (c' , env') = translate_expression c env in
let%bind (a' , _) = translate_expression a env' in
let%bind (b' , _) = translate_expression b env' in

View File

@ -66,10 +66,10 @@ and expression' ppf (e:expression') = match e with
| E_application(a, b) -> fprintf ppf "(%a)@(%a)" expression a expression b
| E_constant(p, lst) -> fprintf ppf "%s %a" p (pp_print_list ~pp_sep:space_sep expression) lst
| E_literal v -> fprintf ppf "%a" value v
| E_empty_map _ -> fprintf ppf "map[]"
| E_empty_list _ -> fprintf ppf "list[]"
| E_make_empty_map _ -> fprintf ppf "map[]"
| E_make_empty_list _ -> fprintf ppf "list[]"
| E_make_none _ -> fprintf ppf "none"
| E_Cond (c, a, b) -> fprintf ppf "%a ? %a : %a" expression c expression a expression b
| E_if_bool (c, a, b) -> fprintf ppf "%a ? %a : %a" expression c expression a expression b
| E_if_none (c, n, ((name, _) , s)) -> fprintf ppf "%a ?? %a : %s -> %a" expression c expression n name expression s
| E_if_left (c, ((name_l, _) , l), ((name_r, _) , r)) ->
fprintf ppf "%a ?? %s -> %a : %s -> %a" expression c name_l expression l name_r expression r

View File

@ -57,10 +57,10 @@ and expression' =
| E_constant of string * expression list
| E_application of expression * expression
| E_variable of var_name
| E_empty_map of (type_value * type_value)
| E_empty_list of type_value
| E_make_empty_map of (type_value * type_value)
| E_make_empty_list of type_value
| E_make_none of type_value
| E_Cond of expression * expression * expression
| E_if_bool of expression * expression * expression
| E_if_none of expression * expression * ((var_name * type_value) * expression)
| E_if_left of expression * ((var_name * type_value) * expression) * ((var_name * type_value) * expression)
| E_let_in of ((var_name * type_value) * expression * expression)

View File

@ -339,7 +339,7 @@ and translate_annotated_expression (env:Environment.t) (ae:AST.annotated_express
let%bind lst' = bind_map_list (translate_annotated_expression env) lst in
let aux : expression -> expression -> expression result = fun prev cur ->
return @@ E_constant ("CONS", [cur ; prev]) in
let%bind (init : expression) = return @@ E_empty_list t in
let%bind (init : expression) = return @@ E_make_empty_list t in
bind_fold_list aux init lst'
| E_map m ->
let%bind (src, dst) = Mini_c.Combinators.get_t_map tv in
@ -350,7 +350,7 @@ and translate_annotated_expression (env:Environment.t) (ae:AST.annotated_express
bind_map_pair (translate_annotated_expression env) (k, v') in
return @@ E_constant ("UPDATE", [k' ; v' ; prev'])
in
let init = return @@ E_empty_map (src, dst) in
let init = return @@ E_make_empty_map (src, dst) in
List.fold_left aux init m
| E_look_up dsi ->
let%bind (ds', i') = bind_map_pair f dsi in
@ -360,7 +360,7 @@ and translate_annotated_expression (env:Environment.t) (ae:AST.annotated_express
match m with
| Match_bool {match_true ; match_false} ->
let%bind (t , f) = bind_map_pair (translate_annotated_expression env) (match_true, match_false) in
return @@ E_Cond (expr', t, f)
return @@ E_if_bool (expr', t, f)
| Match_option { match_none; match_some = ((name, tv), s) } ->
let%bind n = translate_annotated_expression env match_none in
let%bind (tv' , s') =