Mercurial > urweb
comparison src/cjr_print.sml @ 269:fac9fae654e2
Cjrize query
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 02 Sep 2008 09:53:15 -0400 |
parents | 71bafe66dbe1 |
children | 42dfb0d61cf0 |
comparison
equal
deleted
inserted
replaced
268:bacd0ba869e1 | 269:fac9fae654e2 |
---|---|
32 open Print.PD | 32 open Print.PD |
33 open Print | 33 open Print |
34 | 34 |
35 open Cjr | 35 open Cjr |
36 | 36 |
37 val dummyt = (TRecord 0, ErrorMsg.dummySpan) | |
38 | |
37 structure E = CjrEnv | 39 structure E = CjrEnv |
38 structure EM = ErrorMsg | 40 structure EM = ErrorMsg |
39 | 41 |
40 structure SK = struct | 42 structure SK = struct |
41 type ord_key = string | 43 type ord_key = string |
55 | 57 |
56 val dummyTyp = (TDatatype (Enum, 0, ref []), ErrorMsg.dummySpan) | 58 val dummyTyp = (TDatatype (Enum, 0, ref []), ErrorMsg.dummySpan) |
57 | 59 |
58 fun p_typ' par env (t, loc) = | 60 fun p_typ' par env (t, loc) = |
59 case t of | 61 case t of |
60 TTop => string "void*" | 62 TFun (t1, t2) => parenIf par (box [p_typ' true env t2, |
61 | TFun (t1, t2) => parenIf par (box [p_typ' true env t2, | |
62 space, | 63 space, |
63 string "(*)", | 64 string "(*)", |
64 space, | 65 space, |
65 string "(", | 66 string "(", |
66 p_typ env t1, | 67 p_typ env t1, |
526 p_exp env e1, | 527 p_exp env e1, |
527 string ",", | 528 string ",", |
528 space, | 529 space, |
529 p_exp env e2, | 530 p_exp env e2, |
530 string ")"] | 531 string ")"] |
532 | ELet (x, t, e1, e2) => box [string "({", | |
533 newline, | |
534 p_typ env t, | |
535 space, | |
536 p_rel env 0, | |
537 space, | |
538 string "=", | |
539 space, | |
540 p_exp env e1, | |
541 string ";", | |
542 newline, | |
543 p_exp (E.pushERel env x t) e2, | |
544 string ";", | |
545 newline, | |
546 string "})"] | |
547 | |
548 | EQuery {exps, tables, rnum, state, query, body, initial} => | |
549 box [string "query[", | |
550 p_list (fn (x, t) => box [string x, space, string ":", space, p_typ env t]) exps, | |
551 string "] [", | |
552 p_list (fn (x, xts) => box [string x, | |
553 space, | |
554 string ":", | |
555 space, | |
556 string "{", | |
557 p_list (fn (x, t) => box [string x, space, string ":", space, p_typ env t]) xts, | |
558 string "}"]) tables, | |
559 string "] [", | |
560 p_typ env state, | |
561 string "] [", | |
562 string (Int.toString rnum), | |
563 string "]", | |
564 space, | |
565 p_exp env query, | |
566 space, | |
567 string "initial", | |
568 space, | |
569 p_exp env initial, | |
570 space, | |
571 string "in", | |
572 space, | |
573 p_exp (E.pushERel (E.pushERel env "r" dummyt) "acc" dummyt) body] | |
531 | 574 |
532 and p_exp env = p_exp' false env | 575 and p_exp env = p_exp' false env |
533 | 576 |
534 fun p_fun env (fx, n, args, ran, e) = | 577 fun p_fun env (fx, n, args, ran, e) = |
535 let | 578 let |