comparison src/cjrize.sml @ 53:4f641f8fddaa

FFI through cjrize
author Adam Chlipala <adamc@hcoop.net>
date Sun, 22 Jun 2008 10:21:38 -0400
parents 198172560b73
children 717b6f8d8505
comparison
equal deleted inserted replaced
52:198172560b73 53:4f641f8fddaa
91 val (sm, si) = Sm.find (sm, old_xts, xts) 91 val (sm, si) = Sm.find (sm, old_xts, xts)
92 in 92 in
93 ((L'.TRecord si, loc), sm) 93 ((L'.TRecord si, loc), sm)
94 end 94 end
95 | L.TNamed n => ((L'.TNamed n, loc), sm) 95 | L.TNamed n => ((L'.TNamed n, loc), sm)
96 | L.TFfi _ => raise Fail "Cjrize TFfi" 96 | L.TFfi mx => ((L'.TFfi mx, loc), sm)
97 97
98 fun cifyExp ((e, loc), sm) = 98 fun cifyExp ((e, loc), sm) =
99 case e of 99 case e of
100 L.EPrim p => ((L'.EPrim p, loc), sm) 100 L.EPrim p => ((L'.EPrim p, loc), sm)
101 | L.ERel n => ((L'.ERel n, loc), sm) 101 | L.ERel n => ((L'.ERel n, loc), sm)
102 | L.ENamed n => ((L'.ENamed n, loc), sm) 102 | L.ENamed n => ((L'.ENamed n, loc), sm)
103 | L.EFfi _ => raise Fail "Cjrize EFfi" 103 | L.EFfi mx => ((L'.EFfi mx, loc), sm)
104 | L.EFfiApp _ => raise Fail "Cjrize EFfiApp" 104 | L.EFfiApp (m, x, es) =>
105 let
106 val (es, sm) = ListUtil.foldlMap cifyExp sm es
107 in
108 ((L'.EFfiApp (m, x, es), loc), sm)
109 end
105 | L.ECode n => ((L'.ECode n, loc), sm) 110 | L.ECode n => ((L'.ECode n, loc), sm)
106 | L.EApp (e1, e2) => 111 | L.EApp (e1, e2) =>
107 let 112 let
108 val (e1, sm) = cifyExp (e1, sm) 113 val (e1, sm) = cifyExp (e1, sm)
109 val (e2, sm) = cifyExp (e2, sm) 114 val (e2, sm) = cifyExp (e2, sm)