comparison src/source_print.sml @ 156:34ccd7d2bea8

Start of datatype support
author Adam Chlipala <adamc@hcoop.net>
date Thu, 24 Jul 2008 15:02:03 -0400
parents 7420fa18d657
children a158f8c5aa55
comparison
equal deleted inserted replaced
155:4334bb734187 156:34ccd7d2bea8
239 p_con' true c]) 239 p_con' true c])
240 | EFold => string "fold" 240 | EFold => string "fold"
241 241
242 and p_exp e = p_exp' false e 242 and p_exp e = p_exp' false e
243 243
244 fun p_datatype (x, cons) =
245 box [string "datatype",
246 space,
247 string x,
248 space,
249 string "=",
250 space,
251 p_list_sep (box [space, string "|", space])
252 (fn (x, NONE) => string x
253 | (x, SOME t) => box [string x, space, string "of", space, p_con t])
254 cons]
255
244 fun p_sgn_item (sgi, _) = 256 fun p_sgn_item (sgi, _) =
245 case sgi of 257 case sgi of
246 SgiConAbs (x, k) => box [string "con", 258 SgiConAbs (x, k) => box [string "con",
247 space, 259 space,
248 string x, 260 string x,
266 p_kind k, 278 p_kind k,
267 space, 279 space,
268 string "=", 280 string "=",
269 space, 281 space,
270 p_con c] 282 p_con c]
283 | SgiDatatype x => p_datatype x
284 | SgiDatatypeImp (x, ms, x') =>
285 box [string "datatype",
286 space,
287 string x,
288 space,
289 string "=",
290 space,
291 string "datatype",
292 space,
293 p_list_sep (string ".") string (ms @ [x'])]
271 | SgiVal (x, c) => box [string "val", 294 | SgiVal (x, c) => box [string "val",
272 space, 295 space,
273 string x, 296 string x,
274 space, 297 space,
275 string ":", 298 string ":",
369 p_kind k, 392 p_kind k,
370 space, 393 space,
371 string "=", 394 string "=",
372 space, 395 space,
373 p_con c] 396 p_con c]
397 | DDatatype x => p_datatype x
398 | DDatatypeImp (x, ms, x') =>
399 box [string "datatype",
400 space,
401 string x,
402 space,
403 string "=",
404 space,
405 string "datatype",
406 space,
407 p_list_sep (string ".") string (ms @ [x'])]
374 | DVal vi => box [string "val", 408 | DVal vi => box [string "val",
375 space, 409 space,
376 p_vali vi] 410 p_vali vi]
377 | DValRec vis => box [string "val", 411 | DValRec vis => box [string "val",
378 space, 412 space,