Mercurial > urweb
comparison src/elab_print.sml @ 41:1405d8c26790
Beginning of functor elaboration
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 19 Jun 2008 16:04:28 -0400 |
parents | 44b5405e74c7 |
children | b3fbbc6cb1e5 |
comparison
equal
deleted
inserted
replaced
40:e3d3c2791105 | 41:1405d8c26790 |
---|---|
308 p_list_sep newline (fn x => x) psgis | 308 p_list_sep newline (fn x => x) psgis |
309 end, | 309 end, |
310 newline, | 310 newline, |
311 string "end"] | 311 string "end"] |
312 | SgnVar n => string (#1 (E.lookupSgnNamed env n)) | 312 | SgnVar n => string (#1 (E.lookupSgnNamed env n)) |
313 | SgnFun (x, n, sgn, sgn') => box [string "functor", | |
314 space, | |
315 string "(", | |
316 string x, | |
317 space, | |
318 string ":", | |
319 space, | |
320 p_sgn env sgn, | |
321 string ")", | |
322 space, | |
323 string ":", | |
324 space, | |
325 p_sgn (E.pushStrNamedAs env x n sgn) sgn'] | |
313 | SgnError => string "<ERROR>" | 326 | SgnError => string "<ERROR>" |
314 | 327 |
315 fun p_decl env ((d, _) : decl) = | 328 fun p_decl env ((d, _) : decl) = |
316 case d of | 329 case d of |
317 DCon (x, n, k, c) => box [string "con", | 330 DCon (x, n, k, c) => box [string "con", |
365 string "end"] | 378 string "end"] |
366 | StrVar n => string (#1 (E.lookupStrNamed env n)) | 379 | StrVar n => string (#1 (E.lookupStrNamed env n)) |
367 | StrProj (str, s) => box [p_str env str, | 380 | StrProj (str, s) => box [p_str env str, |
368 string ".", | 381 string ".", |
369 string s] | 382 string s] |
383 | StrFun (x, n, sgn, sgn', str) => | |
384 let | |
385 val env' = E.pushStrNamedAs env x n sgn | |
386 in | |
387 box [string "functor", | |
388 space, | |
389 string "(", | |
390 string x, | |
391 space, | |
392 string ":", | |
393 space, | |
394 p_sgn env sgn, | |
395 string ")", | |
396 space, | |
397 string ":", | |
398 space, | |
399 p_sgn env' sgn', | |
400 space, | |
401 string "=>", | |
402 space, | |
403 p_str env' str] | |
404 end | |
370 | StrError => string "<ERROR>" | 405 | StrError => string "<ERROR>" |
371 | 406 |
372 and p_file env file = | 407 and p_file env file = |
373 let | 408 let |
374 val (pds, _) = ListUtil.foldlMap (fn (d, env) => | 409 val (pds, _) = ListUtil.foldlMap (fn (d, env) => |