summaryrefslogtreecommitdiffstats
path: root/syntax.sml
diff options
context:
space:
mode:
authorRose Hogenson <rosehogenson@posteo.net>2024-05-05 21:12:16 -0700
committerRose Hogenson <rosehogenson@posteo.net>2024-05-05 21:12:16 -0700
commit457c482397e2ca745067e5a3ef2c7d71d7daf187 (patch)
treeaef2b8d88421829105a3c6b8887d8ffde39d5e1e /syntax.sml
parentChange some formatting (diff)
downloadsml-457c482397e2ca745067e5a3ef2c7d71d7daf187.tar.zst
Add tuples.
Diffstat (limited to 'syntax.sml')
-rw-r--r--syntax.sml3
1 files changed, 3 insertions, 0 deletions
diff --git a/syntax.sml b/syntax.sml
index 5160e38..fbb4dfd 100644
--- a/syntax.sml
+++ b/syntax.sml
@@ -53,6 +53,7 @@ struct
| LInt of int
| LString of string
| LRecord of lexp list
+ | LSelect of int * lexp
| LPrim of primop
| LSwitch of lexp * (int * lexp) list * lexp
@@ -112,6 +113,7 @@ struct
PWild => "PWild"
| PVar v => "PVar " ^ quote v
| PInt i => "PInt " ^ Int.toString i
+ | PTuple pats => "PTuple " ^ listToString patToString pats
fun exprToStringI (indent : string) (x : expr) : string =
let val self = exprToStringI indent
@@ -160,6 +162,7 @@ struct
| LInt i => "LInt " ^ Int.toString i
| LString s => "LString " ^ quote s
| LRecord l => "LRecord " ^ listToString lexpToString l
+ | LSelect (i, r) => "LSelect (" ^ Int.toString i ^ ", " ^ lexpToString r ^ ")"
| LPrim p => "LPrim " ^ primopToString p
| LSwitch (e, arms, otherwise) => "LSwitch (" ^ lexpToString e ^ ", " ^ listToString (fn (x, e) => "(" ^ Int.toString x ^ ", " ^ lexpToString e ^ ")") arms ^ ", " ^ lexpToString otherwise ^ ")"