Remade the algorithm myself. Still some bugs.
This commit is contained in:
parent
f188cffb8d
commit
8b5cd3cf9a
12 changed files with 584 additions and 257 deletions
17
Grammar.cf
17
Grammar.cf
|
|
@ -1,22 +1,21 @@
|
|||
|
||||
Program. Program ::= [Bind] ;
|
||||
|
||||
Bind. Bind ::= Ident [Ident] "=" Exp ;
|
||||
|
||||
Bind. Bind ::= Ident ":" Type ";"
|
||||
Ident [Ident] "=" Exp ;
|
||||
|
||||
EAnn. Exp5 ::= "(" Exp ":" Type ")" ;
|
||||
EId. Exp4 ::= Ident ;
|
||||
EConst. Exp4 ::= Const ;
|
||||
EInt. Exp4 ::= Integer ;
|
||||
EApp. Exp3 ::= Exp3 Exp4 ;
|
||||
EAdd. Exp1 ::= Exp1 "+" Exp2 ;
|
||||
ELet. Exp ::= "let" Ident "=" Exp "in" Exp ;
|
||||
EAbs. Exp ::= "\\" Ident "." Exp ;
|
||||
|
||||
CInt. Const ::= Integer ;
|
||||
CStr. Const ::= String ;
|
||||
|
||||
TMono. Type1 ::= "Mono" Ident ;
|
||||
TPoly. Type1 ::= "Poly" Ident ;
|
||||
TArrow. Type ::= Type1 "->" Type ;
|
||||
TPol. Type1 ::= "Poly" Ident ;
|
||||
TArr. Type ::= Type1 "->" Type ;
|
||||
|
||||
-- This doesn't seem to work so we'll have to live with ugly keywords for now
|
||||
-- token Upper (upper (letter | digit | '_')*) ;
|
||||
|
|
@ -30,7 +29,3 @@ coercions Exp 5 ;
|
|||
|
||||
comment "--" ;
|
||||
comment "{-" "-}" ;
|
||||
|
||||
-- Adt. Adt ::= "data" UIdent "=" [Constructor] ;
|
||||
-- Sum. Constructor ::= UIdent ;
|
||||
-- separator Constructor "|" ;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue