12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273openCoreopenLocationmoduleP=ParseTreemoduleM=Modelletexpr_to_mterm(e:P.expr):M.mterm=matchunlocewith|Eliteral(Lintn)->M.mk_bintn|Eliteral(Lnatn)->M.mk_bnatn|Eliteral(Ldecimals)->beginletn,d=Core.decimal_string_to_rationalsinM.mk_bratndend|Eliteral(Ltzn)->M.mk_btez(string_to_big_int_tzKtzn)|Eliteral(Lmtzn)->M.mk_btez(string_to_big_int_tzKmtzn)|Eliteral(Lutzn)->M.mk_btez(string_to_big_int_tzKutzn)|Eliteral(Laddresss)->M.mk_addresss|Eliteral(Lstrings)->M.mk_strings|Eliteral(Lboolv)->M.mk_boolv|Eliteral(Ldurations)->M.mk_duration(s|>Core.string_to_duration)|Eliteral(Ldates)->M.mk_date(s|>Core.string_to_date)|Eliteral(Lbytess)->M.mk_bytess|Eliteral(Lpercentn)->beginletn,d=string_to_big_int_percentninM.mk_bratndend|Enothing->M.unit(* | Earray l -> begin
let ll =
match typ with
| Some ({node = (T.Tset t | T.Tlist t); annotation = _}) -> List.map (f ~typ:t) l
| Some ({node = (T.Tmap (tk, tv) | T.Tbig_map (tk, tv)); annotation = _} as tm) -> begin
List.map ( fun (x : PT.expr) ->
match unloc x with
| Etuple [a; b] -> T.Delt (f ~typ:tk a, f ~typ:tv b)
| _ -> error_cc tm) l
end
| Some t -> error_cc t
| None -> List.map f l
in
Dlist ll
end *)(* | Etuple l -> to_one ?typ l *)(* | Eoption o -> begin
let g =
match typ with
| Some ({node = T.Toption t; annotation = _}) -> f ~typ:t
| Some t -> error_cc t
| None -> f ?typ:None
in
match o with
| OSome x -> Dsome (g x)
| ONone _ -> Dnone
end *)(* | Eor o -> begin
let g =
match typ with
| Some ({node = T.Tor (tl, tr); annotation = _}) -> (match o with | Oleft _ -> f ~typ:tl | Oright _ -> f ~typ:tr)
| Some t -> error_cc t
| None -> f ?typ:None
in
match o with
| Oleft (_, _, x) -> Dleft (g x)
| Oright (_, _, x) -> Dright (g x)
end *)(* | Elambda _ -> assert false *)|_->assertfalseletstring_to_mterm(input:string):M.mterm=FIStringinput|>Io.parse_expr|>expr_to_mterm