Started implemented multiple functions.
This commit is contained in:
parent
d41db9bbb8
commit
721192c242
5 changed files with 108 additions and 73 deletions
22
Grammar.cf
22
Grammar.cf
|
|
@ -1,19 +1,27 @@
|
|||
Program. Program ::= [Def] ;
|
||||
|
||||
DExp. Def ::= Ident ":" Type
|
||||
Ident [Ident] "=" Exp ";" ;
|
||||
|
||||
Program. Program ::= "main" "=" Exp ;
|
||||
separator Def "";
|
||||
separator Ident "";
|
||||
separator Type "->";
|
||||
|
||||
EAbs. Exp ::= "\\" Ident "->" Exp ;
|
||||
EId. Exp3 ::= Ident ;
|
||||
EInt. Exp3 ::= Integer ;
|
||||
EApp. Exp2 ::= Exp2 Exp3 ;
|
||||
EAdd. Exp1 ::= Exp1 "+" Exp2 ;
|
||||
ESub. Exp1 ::= Exp1 "-" Exp2 ;
|
||||
EMul. Exp2 ::= Exp2 "*" Exp3 ;
|
||||
EDiv. Exp2 ::= Exp2 "/" Exp3 ;
|
||||
EMod. Exp2 ::= Exp2 "%" Exp3 ;
|
||||
EId. Exp4 ::= Ident ;
|
||||
EInt. Exp4 ::= Integer ;
|
||||
EAbs. Exp ::= "\\" Ident ":" Type "." Exp ;
|
||||
coercions Exp 3 ;
|
||||
|
||||
coercions Exp 4 ;
|
||||
TInt. Type1 ::= "Int" ;
|
||||
TPol. Type1 ::= Ident ;
|
||||
TFun. Type ::= Type "->" Type1;
|
||||
coercions Type 1 ;
|
||||
|
||||
comment "--" ;
|
||||
comment "{-" "-}" ;
|
||||
|
||||
comment "{-" "-}" ;
|
||||
Loading…
Add table
Add a link
Reference in a new issue