Mercurial > urweb
comparison src/cjrize.sml @ 1663:0577be31a435
First part of changes to avoid depending on C function call argument order of evaluation (omitting normal Ur function calls, so far)
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Sat, 07 Jan 2012 15:56:22 -0500 |
parents | 78e0d56b594e |
children | e8149592990e |
comparison
equal
deleted
inserted
replaced
1662:edf86cef0dba | 1663:0577be31a435 |
---|---|
275 ((L'.ESome (t, e), loc), sm) | 275 ((L'.ESome (t, e), loc), sm) |
276 end | 276 end |
277 | L.EFfi mx => ((L'.EFfi mx, loc), sm) | 277 | L.EFfi mx => ((L'.EFfi mx, loc), sm) |
278 | L.EFfiApp (m, x, es) => | 278 | L.EFfiApp (m, x, es) => |
279 let | 279 let |
280 val (es, sm) = ListUtil.foldlMap cifyExp sm es | 280 val (es, sm) = ListUtil.foldlMap (fn ((e, t), sm) => |
281 let | |
282 val (t, sm) = cifyTyp (t, sm) | |
283 val (e, sm) = cifyExp (e, sm) | |
284 in | |
285 ((e, t), sm) | |
286 end) sm es | |
281 in | 287 in |
282 ((L'.EFfiApp (m, x, es), loc), sm) | 288 ((L'.EFfiApp (m, x, es), loc), sm) |
283 end | 289 end |
284 | L.EApp (e1, e2) => | 290 | L.EApp (e1, e2) => |
285 let | 291 let |
382 | 388 |
383 | L.EStrcat (e1, e2) => | 389 | L.EStrcat (e1, e2) => |
384 let | 390 let |
385 val (e1, sm) = cifyExp (e1, sm) | 391 val (e1, sm) = cifyExp (e1, sm) |
386 val (e2, sm) = cifyExp (e2, sm) | 392 val (e2, sm) = cifyExp (e2, sm) |
387 in | 393 val s = (L'.TFfi ("Basis", "string"), loc) |
388 ((L'.EFfiApp ("Basis", "strcat", [e1, e2]), loc), sm) | 394 in |
395 ((L'.EFfiApp ("Basis", "strcat", [(e1, s), (e2, s)]), loc), sm) | |
389 end | 396 end |
390 | 397 |
391 | L.EWrite e => | 398 | L.EWrite e => |
392 let | 399 let |
393 val (e, sm) = cifyExp (e, sm) | 400 val (e, sm) = cifyExp (e, sm) |
671 L.EAbs (x1, _, _, (L.EAbs (x2, _, _, e), _)) => | 678 L.EAbs (x1, _, _, (L.EAbs (x2, _, _, e), _)) => |
672 let | 679 let |
673 val tk = case #1 e1 of | 680 val tk = case #1 e1 of |
674 L.EFfi ("Basis", "initialize") => L'.Initialize | 681 L.EFfi ("Basis", "initialize") => L'.Initialize |
675 | L.EFfi ("Basis", "clientLeaves") => L'.ClientLeaves | 682 | L.EFfi ("Basis", "clientLeaves") => L'.ClientLeaves |
676 | L.EFfiApp ("Basis", "periodic", [(L.EPrim (Prim.Int n), _)]) => L'.Periodic n | 683 | L.EFfiApp ("Basis", "periodic", [((L.EPrim (Prim.Int n), _), _)]) => L'.Periodic n |
677 | _ => (ErrorMsg.errorAt loc "Task kind not fully determined"; | 684 | _ => (ErrorMsg.errorAt loc "Task kind not fully determined"; |
678 L'.Initialize) | 685 L'.Initialize) |
679 val (e, sm) = cifyExp (e, sm) | 686 val (e, sm) = cifyExp (e, sm) |
680 in | 687 in |
681 (SOME (L'.DTask (tk, x1, x2, e), loc), NONE, sm) | 688 (SOME (L'.DTask (tk, x1, x2, e), loc), NONE, sm) |