churf/Grammar.cf
2023-02-18 23:08:27 +01:00

31 lines
738 B
CFEngine3

Program. Program ::= [Bind] ;
Bind. Bind ::= Ident ":" Type ";"
Ident [Ident] "=" Exp ;
EAnn. Exp5 ::= "(" Exp ":" Type ")" ;
EId. Exp4 ::= Ident ;
EInt. Exp4 ::= Integer ;
EApp. Exp3 ::= Exp3 Exp4 ;
EAdd. Exp1 ::= Exp1 "+" Exp2 ;
ELet. Exp ::= "let" Ident "=" Exp "in" Exp ;
EAbs. Exp ::= "\\" Ident "." Exp ;
TMono. Type1 ::= "Mono" Ident ;
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 | '_')*) ;
-- token Lower (lower (letter | digit | '_')*) ;
separator Bind ";" ;
separator Ident " ";
coercions Type 1 ;
coercions Exp 5 ;
comment "--" ;
comment "{-" "-}" ;