comparison src/mono_env.sml @ 109:813e5a52063d

Remove closure conversion in favor of zany fun with modules, which also replaces 'page'
author Adam Chlipala <adamc@hcoop.net>
date Sun, 13 Jul 2008 10:17:06 -0400
parents f0f59e918cac
children 76a4d69719d8
comparison
equal deleted inserted replaced
108:f59553dc1b6a 109:813e5a52063d
37 37
38 type env = { 38 type env = {
39 namedT : (string * typ option) IM.map, 39 namedT : (string * typ option) IM.map,
40 40
41 relE : (string * typ) list, 41 relE : (string * typ) list,
42 namedE : (string * typ * exp option) IM.map 42 namedE : (string * typ * exp option * string) IM.map
43 } 43 }
44 44
45 val empty = { 45 val empty = {
46 namedT = IM.empty, 46 namedT = IM.empty,
47 47
68 68
69 fun lookupERel (env : env) n = 69 fun lookupERel (env : env) n =
70 (List.nth (#relE env, n)) 70 (List.nth (#relE env, n))
71 handle Subscript => raise UnboundRel n 71 handle Subscript => raise UnboundRel n
72 72
73 fun pushENamed (env : env) x n t eo = 73 fun pushENamed (env : env) x n t eo s =
74 {namedT = #namedT env, 74 {namedT = #namedT env,
75 75
76 relE = #relE env, 76 relE = #relE env,
77 namedE = IM.insert (#namedE env, n, (x, t, eo))} 77 namedE = IM.insert (#namedE env, n, (x, t, eo, s))}
78 78
79 fun lookupENamed (env : env) n = 79 fun lookupENamed (env : env) n =
80 case IM.find (#namedE env, n) of 80 case IM.find (#namedE env, n) of
81 NONE => raise UnboundNamed n 81 NONE => raise UnboundNamed n
82 | SOME x => x 82 | SOME x => x
83 83
84 fun declBinds env (d, _) = 84 fun declBinds env (d, _) =
85 case d of 85 case d of
86 DVal (x, n, t, e) => pushENamed env x n t (SOME e) 86 DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s
87 | DPage _ => env 87 | DExport _ => env
88 88
89 end 89 end