Commit d79cbfda authored by Pietro Abate's avatar Pietro Abate
Browse files

[r2004-06-28 01:24:36 by afrisch] Lift translation of argument

Original author: afrisch
Date: 2004-06-28 01:24:36+00:00
parent 204298bf
......@@ -165,14 +165,15 @@ let rec to_cd e t =
and to_cd_descr e = function
| Link t -> to_cd e t
| Arrow (t,s) ->
(* Value.Abstraction (t,s, fun x -> s(<...> (t(x))) *)
(* let y = <...> in Value.Abstraction ([t,s], fun x -> s(y (t(x))) *)
let y = mk_var () in
let x = mk_var () in
let arg = to_ml <:expr< $lid:x$ >> t in
let res = to_cd <:expr< $e$ $arg$ >> s in
let res = to_cd <:expr< $lid:y$ $arg$ >> s in
let abs = <:expr< fun $lid:x$ -> $res$ >> in
let tt = register_type (Types.descr (typ t)) in
let ss = register_type (Types.descr (typ s)) in
<:expr< Value.Abstraction ($tt$,$ss$,$abs$) >>
<:expr< let $lid:y$ = $e$ in Value.Abstraction ([($tt$,$ss$)],$abs$) >>
| Tuple tl ->
(* let (x1,...,xn) = ... in Value.Pair (t1(x1), Value.Pair(...,tn(xn))) *)
let vars = mk_vars tl in
......@@ -246,11 +247,12 @@ and to_ml e t =
and to_ml_descr e = function
| Link t -> to_ml e t
| Arrow (t,s) ->
(* fun x -> s(Eval.eval_apply <...> (t(x))) *)
(* let y = <...> in fun x -> s(Eval.eval_apply y (t(x))) *)
let y = mk_var () in
let x = mk_var () in
let arg = to_cd <:expr< $lid:x$ >> t in
let res = to_ml <:expr< Eval.eval_apply $e$ $arg$ >> s in
<:expr< fun $lid:x$ -> $res$ >>
let res = to_ml <:expr< Eval.eval_apply $lid:y$ $arg$ >> s in
<:expr< let $lid:y$ = $e$ in fun $lid:x$ -> $res$ >>
| Tuple tl ->
(* let (x1,r) = Value.get_pair <...> in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment