comparison src/cjrize.sml @ 165:e52dfb1e6b19

Datatypes through cjrize, modulo decoding
author Adam Chlipala <adamc@hcoop.net>
date Tue, 29 Jul 2008 13:50:53 -0400
parents 6847741e1f5f
children a991431b77eb
comparison
equal deleted inserted replaced
164:6847741e1f5f 165:e52dfb1e6b19
158 | L.EClosure _ => (ErrorMsg.errorAt loc "Nested closure remains in code generation"; 158 | L.EClosure _ => (ErrorMsg.errorAt loc "Nested closure remains in code generation";
159 (dummye, sm)) 159 (dummye, sm))
160 160
161 fun cifyDecl ((d, loc), sm) = 161 fun cifyDecl ((d, loc), sm) =
162 case d of 162 case d of
163 L.DDatatype _ => raise Fail "Cjrize DDatatype" 163 L.DDatatype (x, n, xncs) =>
164 let
165 val (xncs, sm) = ListUtil.foldlMap (fn ((x, n, to), sm) =>
166 case to of
167 NONE => ((x, n, NONE), sm)
168 | SOME t =>
169 let
170 val (t, sm) = cifyTyp (t, sm)
171 in
172 ((x, n, SOME t), sm)
173 end) sm xncs
174 in
175 (SOME (L'.DDatatype (x, n, xncs), loc), NONE, sm)
176 end
164 177
165 | L.DVal (x, n, t, e, _) => 178 | L.DVal (x, n, t, e, _) =>
166 let 179 let
167 val (t, sm) = cifyTyp (t, sm) 180 val (t, sm) = cifyTyp (t, sm)
168 181