From 18e0a92fe023b67f17b1f2e9d21a95edaac1ec61 Mon Sep 17 00:00:00 2001 From: Samuel Hammersberg Date: Mon, 20 Feb 2023 14:39:00 +0100 Subject: [PATCH] Added grammar for case matching. --- Grammar.cf | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Grammar.cf b/Grammar.cf index 8035af5..f98631e 100644 --- a/Grammar.cf +++ b/Grammar.cf @@ -7,11 +7,13 @@ ELet. Exp3 ::= "let" Bind "in" Exp; EApp. Exp2 ::= Exp2 Exp3; EAdd. Exp1 ::= Exp1 "+" Exp2; EAbs. Exp ::= "\\" Ident ":" Type "." Exp; -ECase. Exp ::= "case" Exp "of" "{" [CaseMatch] "}"; +ECase. Exp ::= "case" Exp "of" "{" [CaseMatch] "}" ":" Type; CaseMatch. CaseMatch ::= Case "=>" Exp ; separator CaseMatch ","; -CInt. Case ::= Integer ; + +CInt. Case ::= Integer ; +CatchAll. Case ::= "_" ; Bind. Bind ::= Ident ":" Type ";" Ident [Ident] "=" Exp;