Mercurial > urweb
comparison src/monoize.sml @ 954:2a50da66ffd8
Basic tail recursion introduction seems to be working
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 17 Sep 2009 16:35:11 -0400 |
parents | 358fca527886 |
children | 01a4d936395a |
comparison
equal
deleted
inserted
replaced
953:301530da2062 | 954:2a50da66ffd8 |
---|---|
3135 val (e2, fm) = monoExp (Env.pushERel env x t, st, fm) e2 | 3135 val (e2, fm) = monoExp (Env.pushERel env x t, st, fm) e2 |
3136 in | 3136 in |
3137 ((L'.ELet (x, t', e1, e2), loc), fm) | 3137 ((L'.ELet (x, t', e1, e2), loc), fm) |
3138 end | 3138 end |
3139 | 3139 |
3140 | L.ETailCall (n, es, ek, _, (L.TRecord (L.CRecord (_, []), _), _)) => | |
3141 let | |
3142 val (es, fm) = ListUtil.foldlMap (fn (e, fm) => monoExp (env, st, fm) e) fm es | |
3143 val (ek, fm) = monoExp (env, st, fm) ek | |
3144 | |
3145 val e = (L'.ENamed n, loc) | |
3146 val e = foldl (fn (e, arg) => (L'.EApp (e, arg), loc)) e es | |
3147 val e = (L'.EApp (e, ek), loc) | |
3148 in | |
3149 (e, fm) | |
3150 end | |
3151 | L.ETailCall _ => (E.errorAt loc "Full scope of tail call continuation isn't known"; | |
3152 Print.eprefaces' [("Expression", CorePrint.p_exp env all)]; | |
3153 (dummyExp, fm)) | |
3154 | |
3140 | L.EServerCall (n, es, ek, t, (L.TRecord (L.CRecord (_, []), _), _)) => | 3155 | L.EServerCall (n, es, ek, t, (L.TRecord (L.CRecord (_, []), _), _)) => |
3141 let | 3156 let |
3142 val t = monoType env t | 3157 val t = monoType env t |
3143 val (_, ft, _, name) = Env.lookupENamed env n | 3158 val (_, ft, _, name) = Env.lookupENamed env n |
3144 val (es, fm) = ListUtil.foldlMap (fn (e, fm) => monoExp (env, st, fm) e) fm es | 3159 val (es, fm) = ListUtil.foldlMap (fn (e, fm) => monoExp (env, st, fm) e) fm es |