comparison src/cloconv.sml @ 51:92361a008a10

FFI through monoize
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Jun 2008 10:12:23 -0400
parents 537db4ee89f4
children 198172560b73
comparison
equal deleted inserted replaced
50:d37518b67bd2 51:92361a008a10
67 fun ccTyp (t, loc) = 67 fun ccTyp (t, loc) =
68 case t of 68 case t of
69 L.TFun (t1, t2) => (L'.TFun (ccTyp t1, ccTyp t2), loc) 69 L.TFun (t1, t2) => (L'.TFun (ccTyp t1, ccTyp t2), loc)
70 | L.TRecord xts => (L'.TRecord (map (fn (x, t) => (x, ccTyp t)) xts), loc) 70 | L.TRecord xts => (L'.TRecord (map (fn (x, t) => (x, ccTyp t)) xts), loc)
71 | L.TNamed n => (L'.TNamed n, loc) 71 | L.TNamed n => (L'.TNamed n, loc)
72 | L.TFfi _ => raise Fail "Cloconv TFfi"
72 73
73 structure Ds :> sig 74 structure Ds :> sig
74 type t 75 type t
75 76
76 val empty : t 77 val empty : t
108 fun ccExp env ((e, loc), D) = 109 fun ccExp env ((e, loc), D) =
109 case e of 110 case e of
110 L.EPrim p => ((L'.EPrim p, loc), D) 111 L.EPrim p => ((L'.EPrim p, loc), D)
111 | L.ERel n => ((L'.ERel n, loc), Ds.used (D, n)) 112 | L.ERel n => ((L'.ERel n, loc), Ds.used (D, n))
112 | L.ENamed n => ((L'.ENamed n, loc), D) 113 | L.ENamed n => ((L'.ENamed n, loc), D)
114 | L.EFfi _ => raise Fail "Cloconv EFfi"
115 | L.EFfiApp _ => raise Fail "Cloconv EFfiApp"
113 | L.EApp (e1, e2) => 116 | L.EApp (e1, e2) =>
114 let 117 let
115 val (e1, D) = ccExp env (e1, D) 118 val (e1, D) = ccExp env (e1, D)
116 val (e2, D) = ccExp env (e2, D) 119 val (e2, D) = ccExp env (e2, D)
117 in 120 in