Mercurial > urweb
comparison src/expl_util.sml @ 182:d11754ffe252
Compiled pattern matching to C
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 03 Aug 2008 12:43:20 -0400 |
parents | 33d4a8eea484 |
children | 8e9f97508f0d |
comparison
equal
deleted
inserted
replaced
181:31dfab1d4050 | 182:d11754ffe252 |
---|---|
285 | EWrite e => | 285 | EWrite e => |
286 S.map2 (mfe ctx e, | 286 S.map2 (mfe ctx e, |
287 fn e' => | 287 fn e' => |
288 (EWrite e', loc)) | 288 (EWrite e', loc)) |
289 | 289 |
290 | ECase (e, pes, t) => | 290 | ECase (e, pes, {disc, result}) => |
291 S.bind2 (mfe ctx e, | 291 S.bind2 (mfe ctx e, |
292 fn e' => | 292 fn e' => |
293 S.bind2 (ListUtil.mapfold (fn (p, e) => | 293 S.bind2 (ListUtil.mapfold (fn (p, e) => |
294 S.map2 (mfe ctx e, | 294 S.map2 (mfe ctx e, |
295 fn e' => (p, e'))) pes, | 295 fn e' => (p, e'))) pes, |
296 fn pes' => | 296 fn pes' => |
297 S.map2 (mfc ctx t, | 297 S.bind2 (mfc ctx disc, |
298 fn t' => | 298 fn disc' => |
299 (ECase (e', pes', t'), loc)))) | 299 S.map2 (mfc ctx result, |
300 fn result' => | |
301 (ECase (e', pes', {disc = disc', result = result'}), loc))))) | |
300 in | 302 in |
301 mfe | 303 mfe |
302 end | 304 end |
303 | 305 |
304 fun mapfold {kind = fk, con = fc, exp = fe} = | 306 fun mapfold {kind = fk, con = fc, exp = fe} = |