Some work on a typechecker
This commit is contained in:
parent
d85a0d26b8
commit
b6b2dfa25f
6 changed files with 98 additions and 84 deletions
18
Grammar.cf
18
Grammar.cf
|
|
@ -1,15 +1,23 @@
|
|||
Program. Program ::= [Def] ;
|
||||
|
||||
DExp. Def ::= Ident ":" Type
|
||||
Ident [Ident] "=" Exp ;
|
||||
|
||||
Program. Program ::= "main" "=" Exp ;
|
||||
separator Def "";
|
||||
separator Ident "";
|
||||
separator Type "->";
|
||||
|
||||
EId. Exp3 ::= Ident ;
|
||||
EInt. Exp3 ::= Integer ;
|
||||
EApp. Exp2 ::= Exp2 Exp3 ;
|
||||
-- EApp. Exp2 ::= Exp2 Exp3 ;
|
||||
EAdd. Exp1 ::= Exp1 "+" Exp2 ;
|
||||
EAbs. Exp ::= "\\" Ident "->" Exp ;
|
||||
|
||||
-- EAbs. Exp ::= "\\" Ident ":" Type "." Exp ;
|
||||
coercions Exp 3 ;
|
||||
|
||||
TInt. Type1 ::= "Int" ;
|
||||
TPol. Type1 ::= Ident ;
|
||||
TFun. Type ::= [Type] ;
|
||||
coercions Type 1 ;
|
||||
|
||||
comment "--" ;
|
||||
comment "{-" "-}" ;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue