comparison src/elab_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 c7a6e6dbc318
children 8e9f97508f0d
comparison
equal deleted inserted replaced
181:31dfab1d4050 182:d11754ffe252
306 | EFold k => 306 | EFold k =>
307 S.map2 (mfk k, 307 S.map2 (mfk k,
308 fn k' => 308 fn k' =>
309 (EFold k', loc)) 309 (EFold k', loc))
310 310
311 | ECase (e, pes, t) => 311 | ECase (e, pes, {disc, result}) =>
312 S.bind2 (mfe ctx e, 312 S.bind2 (mfe ctx e,
313 fn e' => 313 fn e' =>
314 S.bind2 (ListUtil.mapfold (fn (p, e) => 314 S.bind2 (ListUtil.mapfold (fn (p, e) =>
315 S.map2 (mfe ctx e, 315 S.map2 (mfe ctx e,
316 fn e' => (p, e'))) pes, 316 fn e' => (p, e'))) pes,
317 fn pes' => 317 fn pes' =>
318 S.map2 (mfc ctx t, 318 S.bind2 (mfc ctx disc,
319 fn t' => 319 fn disc' =>
320 (ECase (e', pes', t'), loc)))) 320 S.map2 (mfc ctx result,
321 fn result' =>
322 (ECase (e', pes', {disc = disc', result = result'}), loc)))))
321 323
322 | EError => S.return2 eAll 324 | EError => S.return2 eAll
323 in 325 in
324 mfe 326 mfe
325 end 327 end