comparison src/cjr_print.sml @ 102:5f04adf47f48

Writing HTML
author Adam Chlipala <adamc@hcoop.net>
date Thu, 10 Jul 2008 14:02:54 -0400
parents 717b6f8d8505
children d101cb1efe55
comparison
equal deleted inserted replaced
101:717b6f8d8505 102:5f04adf47f48
139 space, 139 space,
140 string ";", 140 string ";",
141 newline, 141 newline,
142 string "})"] 142 string "})"]
143 end 143 end
144
145 | EWrite e => box [string "(lw_write(",
146 p_exp env e,
147 string "), lw_unit_v)"]
144 148
145 and p_exp env = p_exp' false env 149 and p_exp env = p_exp' false env
146 150
147 fun p_decl env ((d, _) : decl) = 151 fun p_decl env ((d, _) : decl) =
148 case d of 152 case d of
217 TRecord ari => 221 TRecord ari =>
218 let 222 let
219 val r = (ERecord (ri, [("env", envx), 223 val r = (ERecord (ri, [("env", envx),
220 ("arg", (ERecord (ari, []), loc))]), loc) 224 ("arg", (ERecord (ari, []), loc))]), loc)
221 in 225 in
222 box [string "return", 226 box [p_exp env (EApp (code, r), loc),
223 space,
224 p_exp env (EApp (code, r), loc),
225 string ";"] 227 string ";"]
226 end 228 end
227 | _ => string "Page handler is too complicated! [6]" 229 | _ => string "Page handler is too complicated! [6]"
228 end 230 end
229 | _ => string "Page handler is too complicated! [4]" 231 | _ => string "Page handler is too complicated! [4]"
245 box [string "#include \"lacweb.h\"", 247 box [string "#include \"lacweb.h\"",
246 newline, 248 newline,
247 newline, 249 newline,
248 p_list_sep newline (fn x => x) pds, 250 p_list_sep newline (fn x => x) pds,
249 newline, 251 newline,
250 string "char *lw_handle(void) {", 252 string "void lw_handle(void) {",
251 newline, 253 newline,
252 p_list_sep newline (fn x => x) pds', 254 p_list_sep newline (fn x => x) pds',
253 newline, 255 newline,
254 string "}", 256 string "}",
255 newline] 257 newline]