comparison src/core_print.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 5f04adf47f48
children 3739af9e727a
comparison
equal deleted inserted replaced
108:f59553dc1b6a 109:813e5a52063d
143 and p_name env (all as (c, _)) = 143 and p_name env (all as (c, _)) =
144 case c of 144 case c of
145 CName s => string s 145 CName s => string s
146 | _ => p_con env all 146 | _ => p_con env all
147 147
148 fun p_enamed env n =
149 (if !debug then
150 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n)
151 else
152 string (#1 (E.lookupENamed env n)))
153 handle E.UnboundNamed _ => string ("UNBOUNDN_" ^ Int.toString n)
154
148 fun p_exp' par env (e, _) = 155 fun p_exp' par env (e, _) =
149 case e of 156 case e of
150 EPrim p => Prim.p_t p 157 EPrim p => Prim.p_t p
151 | ERel n => 158 | ERel n =>
152 ((if !debug then 159 ((if !debug then
153 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n) 160 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n)
154 else 161 else
155 string (#1 (E.lookupERel env n))) 162 string (#1 (E.lookupERel env n)))
156 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n)) 163 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n))
157 | ENamed n => 164 | ENamed n => p_enamed env n
158 ((if !debug then
159 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n)
160 else
161 string (#1 (E.lookupENamed env n)))
162 handle E.UnboundNamed _ => string ("UNBOUNDN_" ^ Int.toString n))
163 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] 165 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
164 | EFfiApp (m, x, es) => box [string "FFI(", 166 | EFfiApp (m, x, es) => box [string "FFI(",
165 string m, 167 string m,
166 string ".", 168 string ".",
167 string x, 169 string x,
253 space, 255 space,
254 string "=", 256 string "=",
255 space, 257 space,
256 p_con env c] 258 p_con env c]
257 end 259 end
258 | DVal (x, n, t, e) => 260 | DVal (x, n, t, e, s) =>
259 let 261 let
260 val xp = if !debug then 262 val xp = if !debug then
261 box [string x, 263 box [string x,
262 string "__", 264 string "__",
263 string (Int.toString n)] 265 string (Int.toString n)]
266 in 268 in
267 box [string "val", 269 box [string "val",
268 space, 270 space,
269 xp, 271 xp,
270 space, 272 space,
273 string "as",
274 space,
275 string s,
276 space,
271 string ":", 277 string ":",
272 space, 278 space,
273 p_con env t, 279 p_con env t,
274 space, 280 space,
275 string "=", 281 string "=",
276 space, 282 space,
277 p_exp env e] 283 p_exp env e]
278 end 284 end
279 | DPage (c, e) => box [string "page", 285 | DExport n => box [string "export",
280 p_con env c, 286 space,
281 space, 287 p_enamed env n]
282 string "=",
283 space,
284 p_exp env e]
285 288
286 fun p_file env file = 289 fun p_file env file =
287 let 290 let
288 val (pds, _) = ListUtil.foldlMap (fn (d, env) => 291 val (pds, _) = ListUtil.foldlMap (fn (d, env) =>
289 (p_decl env d, 292 (p_decl env d,