Mercurial > urweb
comparison src/mono_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 | d101cb1efe55 |
children | 2d6116de9cca |
comparison
equal
deleted
inserted
replaced
108:f59553dc1b6a | 109:813e5a52063d |
---|---|
60 string (#1 (E.lookupTNamed env n)) | 60 string (#1 (E.lookupTNamed env n)) |
61 | TFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] | 61 | TFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] |
62 | 62 |
63 and p_typ env = p_typ' false env | 63 and p_typ env = p_typ' false env |
64 | 64 |
65 fun p_enamed env n = | |
66 if !debug then | |
67 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n) | |
68 else | |
69 string (#1 (E.lookupENamed env n)) | |
70 | |
65 fun p_exp' par env (e, _) = | 71 fun p_exp' par env (e, _) = |
66 case e of | 72 case e of |
67 EPrim p => Prim.p_t p | 73 EPrim p => Prim.p_t p |
68 | ERel n => | 74 | ERel n => |
69 if !debug then | 75 if !debug then |
70 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n) | 76 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n) |
71 else | 77 else |
72 string (#1 (E.lookupERel env n)) | 78 string (#1 (E.lookupERel env n)) |
73 | ENamed n => | 79 | ENamed n => p_enamed env n |
74 if !debug then | 80 |
75 string (#1 (E.lookupENamed env n) ^ "__" ^ Int.toString n) | |
76 else | |
77 string (#1 (E.lookupENamed env n)) | |
78 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] | 81 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] |
79 | EFfiApp (m, x, es) => box [string "FFI(", | 82 | EFfiApp (m, x, es) => box [string "FFI(", |
80 string m, | 83 string m, |
81 string ".", | 84 string ".", |
82 string x, | 85 string x, |
129 | 132 |
130 and p_exp env = p_exp' false env | 133 and p_exp env = p_exp' false env |
131 | 134 |
132 fun p_decl env ((d, _) : decl) = | 135 fun p_decl env ((d, _) : decl) = |
133 case d of | 136 case d of |
134 DVal (x, n, t, e) => | 137 DVal (x, n, t, e, s) => |
135 let | 138 let |
136 val xp = if !debug then | 139 val xp = if !debug then |
137 box [string x, | 140 box [string x, |
138 string "__", | 141 string "__", |
139 string (Int.toString n)] | 142 string (Int.toString n)] |
142 in | 145 in |
143 box [string "val", | 146 box [string "val", |
144 space, | 147 space, |
145 xp, | 148 xp, |
146 space, | 149 space, |
150 string "as", | |
151 space, | |
152 string s, | |
153 space, | |
147 string ":", | 154 string ":", |
148 space, | 155 space, |
149 p_typ env t, | 156 p_typ env t, |
150 space, | 157 space, |
151 string "=", | 158 string "=", |
152 space, | 159 space, |
153 p_exp env e] | 160 p_exp env e] |
154 end | 161 end |
155 | DPage (xcs, e) => box [string "page", | 162 |
156 string "[", | 163 | DExport n => box [string "export", |
157 p_list (fn (x, t) => | 164 space, |
158 box [string x, | 165 p_enamed env n] |
159 space, | |
160 string ":", | |
161 space, | |
162 p_typ env t]) xcs, | |
163 string "]", | |
164 space, | |
165 string "=", | |
166 space, | |
167 p_exp env e] | |
168 | 166 |
169 fun p_file env file = | 167 fun p_file env file = |
170 let | 168 let |
171 val (pds, _) = ListUtil.foldlMap (fn (d, env) => | 169 val (pds, _) = ListUtil.foldlMap (fn (d, env) => |
172 (p_decl env d, | 170 (p_decl env d, |