comparison src/core_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 3bbed533fbd2
children 8e9f97508f0d
comparison
equal deleted inserted replaced
181:31dfab1d4050 182:d11754ffe252
300 | EFold k => 300 | EFold k =>
301 S.map2 (mfk k, 301 S.map2 (mfk k,
302 fn k' => 302 fn k' =>
303 (EFold k', loc)) 303 (EFold k', loc))
304 304
305 | ECase (e, pes, t) => 305 | ECase (e, pes, {disc, result}) =>
306 S.bind2 (mfe ctx e, 306 S.bind2 (mfe ctx e,
307 fn e' => 307 fn e' =>
308 S.bind2 (ListUtil.mapfold (fn (p, e) => 308 S.bind2 (ListUtil.mapfold (fn (p, e) =>
309 S.map2 (mfe ctx e, 309 S.map2 (mfe ctx e,
310 fn e' => (p, e'))) pes, 310 fn e' => (p, e'))) pes,
311 fn pes' => 311 fn pes' =>
312 S.map2 (mfc ctx t, 312 S.bind2 (mfc ctx disc,
313 fn t' => 313 fn disc' =>
314 (ECase (e', pes', t'), loc)))) 314 S.map2 (mfc ctx result,
315 fn result' =>
316 (ECase (e', pes', {disc = disc', result = result'}), loc)))))
315 317
316 | EWrite e => 318 | EWrite e =>
317 S.map2 (mfe ctx e, 319 S.map2 (mfe ctx e,
318 fn e' => 320 fn e' =>
319 (EWrite e', loc)) 321 (EWrite e', loc))