comparison src/core_untangle.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 ef6de4075dc1
children dfe34fad749d
comparison
equal deleted inserted replaced
953:301530da2062 954:2a50da66ffd8
36 structure IM = IntBinaryMap 36 structure IM = IntBinaryMap
37 37
38 fun default (k, s) = s 38 fun default (k, s) = s
39 39
40 fun exp thisGroup (e, s) = 40 fun exp thisGroup (e, s) =
41 case e of 41 let
42 ENamed n => 42 fun try n =
43 if IS.member (thisGroup, n) then 43 if IS.member (thisGroup, n) then
44 IS.add (s, n) 44 IS.add (s, n)
45 else 45 else
46 s 46 s
47 | EClosure (n, _) => 47 in
48 if IS.member (thisGroup, n) then 48 case e of
49 IS.add (s, n) 49 ENamed n => try n
50 else 50 | EClosure (n, _) => try n
51 s 51 | EServerCall (n, _, _, _, _) => try n
52 52 | ETailCall (n, _, _, _, _) => try n
53 | _ => s 53 | _ => s
54 end
54 55
55 fun untangle file = 56 fun untangle file =
56 let 57 let
57 fun expUsed thisGroup = U.Exp.fold {con = default, 58 fun expUsed thisGroup = U.Exp.fold {con = default,
58 kind = default, 59 kind = default,