comparison src/mono_print.sml @ 188:8e9f97508f0d

Datatype representation optimization
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:49:21 -0400
parents 88d46972de53
children 890a61991263
comparison
equal deleted inserted replaced
187:fb6ed259f5bd 188:8e9f97508f0d
51 space, 51 space,
52 string ":", 52 string ":",
53 space, 53 space,
54 p_typ env t]) xcs, 54 p_typ env t]) xcs,
55 string "}"] 55 string "}"]
56 | TDatatype (n, _) => 56 | TDatatype (_, n, _) =>
57 ((if !debug then 57 ((if !debug then
58 string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n) 58 string (#1 (E.lookupDatatype env n) ^ "__" ^ Int.toString n)
59 else 59 else
60 string (#1 (E.lookupDatatype env n))) 60 string (#1 (E.lookupDatatype env n)))
61 handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n)) 61 handle E.UnboundNamed _ => string ("UNBOUND_DATATYPE_" ^ Int.toString n))
89 fun p_pat' par env (p, _) = 89 fun p_pat' par env (p, _) =
90 case p of 90 case p of
91 PWild => string "_" 91 PWild => string "_"
92 | PVar (s, _) => string s 92 | PVar (s, _) => string s
93 | PPrim p => Prim.p_t p 93 | PPrim p => Prim.p_t p
94 | PCon (n, NONE) => p_patCon env n 94 | PCon (_, n, NONE) => p_patCon env n
95 | PCon (n, SOME p) => parenIf par (box [p_patCon env n, 95 | PCon (_, n, SOME p) => parenIf par (box [p_patCon env n,
96 space, 96 space,
97 p_pat' true env p]) 97 p_pat' true env p])
98 | PRecord xps => 98 | PRecord xps =>
99 box [string "{", 99 box [string "{",
100 p_list_sep (box [string ",", space]) (fn (x, p, _) => 100 p_list_sep (box [string ",", space]) (fn (x, p, _) =>
115 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n) 115 string (#1 (E.lookupERel env n) ^ "_" ^ Int.toString n)
116 else 116 else
117 string (#1 (E.lookupERel env n))) 117 string (#1 (E.lookupERel env n)))
118 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n)) 118 handle E.UnboundRel _ => string ("UNBOUND_" ^ Int.toString n))
119 | ENamed n => p_enamed env n 119 | ENamed n => p_enamed env n
120 | ECon (pc, NONE) => p_patCon env pc 120 | ECon (_, pc, NONE) => p_patCon env pc
121 | ECon (pc, SOME e) => parenIf par (box [p_patCon env pc, 121 | ECon (_, pc, SOME e) => parenIf par (box [p_patCon env pc,
122 space, 122 space,
123 p_exp' true env e]) 123 p_exp' true env e])
124 124
125 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"] 125 | EFfi (m, x) => box [string "FFI(", string m, string ".", string x, string ")"]
126 | EFfiApp (m, x, es) => box [string "FFI(", 126 | EFfiApp (m, x, es) => box [string "FFI(",
127 string m, 127 string m,
128 string ".", 128 string ".",