Started adding cases to the grammar.

This commit is contained in:
Samuel Hammersberg 2023-02-17 15:25:06 +01:00
parent d345ccb33b
commit 7cedc2e28c
2 changed files with 28 additions and 19 deletions

View file

@ -1,12 +1,21 @@
Program. Program ::= [Bind];
EId. Exp3 ::= Ident;
EInt. Exp3 ::= Integer;
ELet. Exp3 ::= "let" [Bind] "in" Exp;
EApp. Exp2 ::= Exp2 Exp3;
EAdd. Exp1 ::= Exp1 "+" Exp2;
EAbs. Exp ::= "\\" Ident ":" Type "." Exp;
EAnn. Exp3 ::= "(" Exp ":" Type ")";
EId. Exp3 ::= Ident;
EInt. Exp3 ::= Integer;
ELet. Exp3 ::= "let" [Bind] "in" Exp;
EApp. Exp2 ::= Exp2 Exp3;
EAdd. Exp1 ::= Exp1 "+" Exp2;
EAbs. Exp ::= "\\" Ident ":" Type "." Exp;
EAnn. Exp3 ::= "(" Exp ":" Type ")";
ECase. Exp ::= "case" Exp "of" "{" [CaseMatch] "}";
--
CaseMatch. CaseMatch ::= Case "=>" Exp ;
separator CaseMatch ",";
--terminator CaseMatch ".";
CInt. Case ::= Integer ;
Bind. Bind ::= Ident ":" Type ";"
Ident [Ident] "=" Exp ;