Mercurial > urweb
comparison src/reduce.sml @ 511:6d6222e045b0
crud1 compiles with new Reduce
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Wed, 26 Nov 2008 15:03:45 -0500 |
parents | c644ec94866d |
children | 0dd40b6bfdf3 |
comparison
equal
deleted
inserted
replaced
510:c644ec94866d | 511:6d6222e045b0 |
---|---|
101 in | 101 in |
102 case #1 c1 of | 102 case #1 c1 of |
103 CAbs (_, _, b) => | 103 CAbs (_, _, b) => |
104 con (KnownC c2 :: deKnown env) b | 104 con (KnownC c2 :: deKnown env) b |
105 | 105 |
106 | CApp ((CApp (fold as (CFold _, _), f), _), i) => | 106 | CApp ((CApp ((CFold _, _), f), _), i) => |
107 (case #1 c2 of | 107 (case #1 c2 of |
108 CRecord (_, []) => i | 108 CRecord (_, []) => i |
109 | CRecord (k, (x, c) :: rest) => | 109 | CRecord (k, (x, c) :: rest) => |
110 con (deKnown env) | 110 con (deKnown env) |
111 (CApp ((CApp ((CApp (f, x), loc), c), loc), | 111 (CApp ((CApp ((CApp (f, x), loc), c), loc), |
112 (CApp ((CApp ((CApp (fold, f), loc), i), loc), | 112 (CApp (c1, |
113 (CRecord (k, rest), loc)), loc)), loc) | 113 (CRecord (k, rest), loc)), loc)), loc) |
114 | _ => (CApp (c1, c2), loc)) | 114 | _ => (CApp (c1, c2), loc)) |
115 | 115 |
116 | _ => (CApp (c1, c2), loc) | 116 | _ => (CApp (c1, c2), loc) |
117 end | 117 end |
213 val e = exp env e | 213 val e = exp env e |
214 val c = con env c | 214 val c = con env c |
215 in | 215 in |
216 case #1 e of | 216 case #1 e of |
217 ECAbs (_, _, b) => exp (KnownC c :: deKnown env) b | 217 ECAbs (_, _, b) => exp (KnownC c :: deKnown env) b |
218 | |
219 | EApp ((EApp ((ECApp ((EFold _, _), _), _), f), _), i) => | |
220 (case #1 c of | |
221 CRecord (_, []) => i | |
222 | CRecord (k, (nm, v) :: rest) => | |
223 let | |
224 val rest = (CRecord (k, rest), loc) | |
225 in | |
226 exp (deKnown env) | |
227 (EApp ((ECApp ((ECApp ((ECApp (f, nm), loc), v), loc), rest), loc), | |
228 (ECApp (e, rest), loc)), loc) | |
229 end | |
230 | _ => (ECApp (e, c), loc)) | |
231 | |
218 | _ => (ECApp (e, c), loc) | 232 | _ => (ECApp (e, c), loc) |
219 end | 233 end |
220 | 234 |
221 | ECAbs (x, k, e) => (ECAbs (x, k, exp (UnknownC :: env) e), loc) | 235 | ECAbs (x, k, e) => (ECAbs (x, k, exp (UnknownC :: env) e), loc) |
222 | 236 |