1 |
(* COPYRIGHT (c) 1997 YALE FLINT PROJECT *) |
(* COPYRIGHT (c) 1997 YALE FLINT PROJECT *) |
2 |
(* flintnm.sml *) |
(* monnier@cs.yale.edu *) |
3 |
|
|
4 |
(* Converting the Standard PLambda.lexp into the FLINT IL *) |
(* Converting the Standard PLambda.lexp into the FLINT IL *) |
5 |
signature FLINTNM = |
signature FLINTNM = |
12 |
|
|
13 |
local structure LT = PLambdaType |
local structure LT = PLambdaType |
14 |
structure FL = PFlatten (* argument flattening *) |
structure FL = PFlatten (* argument flattening *) |
|
structure LV = LambdaVar |
|
15 |
structure DI = DebIndex |
structure DI = DebIndex |
16 |
structure PT = PrimTyc |
structure PT = PrimTyc |
17 |
structure PO = PrimOp |
structure PO = PrimOp |
24 |
|
|
25 |
val say = Control.Print.say |
val say = Control.Print.say |
26 |
val mkv = LambdaVar.mkLvar |
val mkv = LambdaVar.mkLvar |
27 |
|
val cplv = LambdaVar.dupLvar |
28 |
val ident = fn le : L.lexp => le |
val ident = fn le : L.lexp => le |
29 |
|
|
30 |
val (iadd_prim, uadd_prim) = |
val (iadd_prim, uadd_prim) = |
177 |
(* then translate each function in turn *) |
(* then translate each function in turn *) |
178 |
val funs = map (fn ((f_lv,f_lty),L.FN(arg_lv,arg_lty,body)) => |
val funs = map (fn ((f_lv,f_lty),L.FN(arg_lv,arg_lty,body)) => |
179 |
#1(tofundec(venv', d, |
#1(tofundec(venv', d, |
180 |
f_lv, arg_lv, arg_lty, body, true))) |
f_lv, arg_lv, arg_lty, body, true)) |
181 |
|
| _ => bug "non-function in L.FIX") |
182 |
(ListPair.zip(ListPair.zip(lvs,ltys),lexps)) |
(ListPair.zip(ListPair.zip(lvs,ltys),lexps)) |
183 |
|
|
184 |
(* finally, translate the lexp *) |
(* finally, translate the lexp *) |
566 |
fun norm (lexp as L.FN(arg_lv,arg_lty,e)) = |
fun norm (lexp as L.FN(arg_lv,arg_lty,e)) = |
567 |
(#1(tofundec(LT.initLtyEnv, DI.top, mkv(), arg_lv, arg_lty, e, false)) |
(#1(tofundec(LT.initLtyEnv, DI.top, mkv(), arg_lv, arg_lty, e, false)) |
568 |
handle x => raise x) |
handle x => raise x) |
569 |
(* | norm _ = bug "unexpected toplevel lexp" *) |
| norm _ = bug "unexpected toplevel lexp" |
570 |
|
|
571 |
end (* toplevel local *) |
end (* toplevel local *) |
572 |
end (* structure FlintNM *) |
end (* structure FlintNM *) |