From 457c482397e2ca745067e5a3ef2c7d71d7daf187 Mon Sep 17 00:00:00 2001 From: Rose Hogenson Date: Sun, 5 May 2024 21:12:16 -0700 Subject: Add tuples. --- syntax.sml | 3 +++ 1 file changed, 3 insertions(+) (limited to 'syntax.sml') 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 ^ ")" -- cgit v1.3.1