aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/source_print.sml
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 10:47:10 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-11-01 10:47:10 -0400
commit89f97891a33b5c0a8971d3508059a139a8815091 (patch)
treea11a164b5f4671f27a3e77a5346b4e981e35b801 /src/source_print.sml
parent389aae9254a3bdee3e79bb75b7355de270f2e8dd (diff)
Parsing 'let'
Diffstat (limited to 'src/source_print.sml')
-rw-r--r--src/source_print.sml55
1 files changed, 39 insertions, 16 deletions
diff --git a/src/source_print.sml b/src/source_print.sml
index a25be2d4..9e6608df 100644
--- a/src/source_print.sml
+++ b/src/source_print.sml
@@ -285,8 +285,47 @@ fun p_exp' par (e, _) =
| EWild => string "_"
+ | ELet (ds, e) => box [string "let",
+ newline,
+ box [p_list_sep newline p_edecl ds],
+ newline,
+ string "in",
+ newline,
+ box [p_exp e],
+ newline,
+ string "end"]
+
and p_exp e = p_exp' false e
+and p_edecl (d, _) =
+ case d of
+ EDVal vi => box [string "val",
+ space,
+ p_vali vi]
+ | EDValRec vis => box [string "val",
+ space,
+ string "rec",
+ space,
+ p_list_sep (box [newline, string "and", space]) p_vali vis]
+
+and p_vali (x, co, e) =
+ case co of
+ NONE => box [string x,
+ space,
+ string "=",
+ space,
+ p_exp e]
+ | SOME t => box [string x,
+ space,
+ string ":",
+ space,
+ p_con t,
+ space,
+ string "=",
+ space,
+ p_exp e]
+
+
fun p_datatype (x, xs, cons) =
box [string "datatype",
space,
@@ -424,22 +463,6 @@ and p_sgn (sgn, _) =
| SgnProj (m, ms, x) => p_list_sep (string ".") string (m :: ms @ [x])
-fun p_vali (x, co, e) =
- case co of
- NONE => box [string x,
- space,
- string "=",
- space,
- p_exp e]
- | SOME t => box [string x,
- space,
- string ":",
- space,
- p_con t,
- space,
- string "=",
- space,
- p_exp e]
fun p_decl ((d, _) : decl) =
case d of