comparison src/flat_print.sml @ 29:537db4ee89f4

Translation to Cjr
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Jun 2008 18:28:43 -0400
parents 4ab19c19665f
children 1c91c5e6840f
comparison
equal deleted inserted replaced
28:104d43266b33 29:537db4ee89f4
40 40
41 val dummyTyp = (TNamed 0, ErrorMsg.dummySpan) 41 val dummyTyp = (TNamed 0, ErrorMsg.dummySpan)
42 42
43 fun p_typ' par env (t, _) = 43 fun p_typ' par env (t, _) =
44 case t of 44 case t of
45 TFun (t1, t2) => parenIf par (box [p_typ' true env t1, 45 TTop => string "?"
46 | TFun (t1, t2) => parenIf par (box [p_typ' true env t1,
46 space, 47 space,
47 string "->", 48 string "->",
48 space, 49 space,
49 p_typ env t2]) 50 p_typ env t2])
50 | TCode (t1, t2) => parenIf par (box [p_typ' true env t1, 51 | TCode (t1, t2) => parenIf par (box [p_typ' true env t1,
86 | EApp (e1, e2) => parenIf par (box [p_exp env e1, 87 | EApp (e1, e2) => parenIf par (box [p_exp env e1,
87 space, 88 space,
88 p_exp' true env e2]) 89 p_exp' true env e2])
89 90
90 | ERecord xes => box [string "{", 91 | ERecord xes => box [string "{",
91 p_list (fn (x, e) => 92 p_list (fn (x, e, _) =>
92 box [string x, 93 box [string x,
93 space, 94 space,
94 string "=", 95 string "=",
95 space, 96 space,
96 p_exp env e]) xes, 97 p_exp env e]) xes,
100 string ".", 101 string ".",
101 string x] 102 string x]
102 103
103 | ELet (xes, e) => 104 | ELet (xes, e) =>
104 let 105 let
105 val (env, pps) = foldl (fn ((x, e), (env, pps)) => 106 val (env, pps) = foldl (fn ((x, _, e), (env, pps)) =>
106 (E.pushERel env x dummyTyp, 107 (E.pushERel env x dummyTyp,
107 List.revAppend ([space, 108 List.revAppend ([space,
108 string "val", 109 string "val",
109 space, 110 space,
110 string x, 111 string x,