comparison src/elab_print.sml @ 34:44b5405e74c7

Elaborating module projection
author Adam Chlipala <adamc@hcoop.net>
date Tue, 17 Jun 2008 16:38:54 -0400
parents 0ff8c2728634
children 1405d8c26790
comparison
equal deleted inserted replaced
33:535c324f0b35 34:44b5405e74c7
91 if !debug then 91 if !debug then
92 string (#1 (E.lookupCRel env n) ^ "_" ^ Int.toString n) 92 string (#1 (E.lookupCRel env n) ^ "_" ^ Int.toString n)
93 else 93 else
94 string (#1 (E.lookupCRel env n)) 94 string (#1 (E.lookupCRel env n))
95 | CNamed n => 95 | CNamed n =>
96 if !debug then 96 ((if !debug then
97 string (#1 (E.lookupCNamed env n) ^ "__" ^ Int.toString n) 97 string (#1 (E.lookupCNamed env n) ^ "__" ^ Int.toString n)
98 else 98 else
99 string (#1 (E.lookupCNamed env n)) 99 string (#1 (E.lookupCNamed env n)))
100 handle E.UnboundNamed _ => string ("UNBOUND_NAMED" ^ Int.toString n))
101 | CModProj (m1, ms, x) =>
102 let
103 val (m1x, sgn) = E.lookupStrNamed env m1
104
105 val m1s = if !debug then
106 m1x ^ "__" ^ Int.toString m1
107 else
108 m1x
109 in
110 p_list_sep (string ".") string (m1x :: ms @ [x])
111 end
100 112
101 | CApp (c1, c2) => parenIf par (box [p_con env c1, 113 | CApp (c1, c2) => parenIf par (box [p_con env c1,
102 space, 114 space,
103 p_con' true env c2]) 115 p_con' true env c2])
104 | CAbs (x, k, c) => parenIf par (box [string "fn", 116 | CAbs (x, k, c) => parenIf par (box [string "fn",
165 | ENamed n => 177 | ENamed n =>
166 if !debug then 178 if !debug then
167 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n) 179 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n)
168 else 180 else
169 string (#1 (E.lookupENamed env n)) 181 string (#1 (E.lookupENamed env n))
182 | EModProj (m1, ms, x) =>
183 let
184 val (m1x, sgn) = E.lookupStrNamed env m1
185
186 val m1s = if !debug then
187 m1x ^ "__" ^ Int.toString m1
188 else
189 m1x
190 in
191 p_list_sep (string ".") string (m1x :: ms @ [x])
192 end
193
170 | EApp (e1, e2) => parenIf par (box [p_exp env e1, 194 | EApp (e1, e2) => parenIf par (box [p_exp env e1,
171 space, 195 space,
172 p_exp' true env e2]) 196 p_exp' true env e2])
173 | EAbs (x, t, _, e) => parenIf par (box [string "fn", 197 | EAbs (x, t, _, e) => parenIf par (box [string "fn",
174 space, 198 space,
338 newline, 362 newline,
339 p_file env ds, 363 p_file env ds,
340 newline, 364 newline,
341 string "end"] 365 string "end"]
342 | StrVar n => string (#1 (E.lookupStrNamed env n)) 366 | StrVar n => string (#1 (E.lookupStrNamed env n))
367 | StrProj (str, s) => box [p_str env str,
368 string ".",
369 string s]
343 | StrError => string "<ERROR>" 370 | StrError => string "<ERROR>"
344 371
345 and p_file env file = 372 and p_file env file =
346 let 373 let
347 val (pds, _) = ListUtil.foldlMap (fn (d, env) => 374 val (pds, _) = ListUtil.foldlMap (fn (d, env) =>