Added grammar for case matching.

This commit is contained in:
Samuel Hammersberg 2023-02-20 14:39:00 +01:00
parent a4c12ede79
commit 18e0a92fe0

View file

@ -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;