45 lines
1.1 KiB
CFEngine3
45 lines
1.1 KiB
CFEngine3
|
|
Prog. Program ::= [Definition];
|
|
|
|
Def. Definition ::= Ident ":" Type "\n" Ident [Ident] "=" Exp;
|
|
|
|
KStar. Kind ::= "*";
|
|
KArr. Kind1 ::= Kind "→" Kind;
|
|
_. Kind1 ::= Kind;
|
|
|
|
token UIdent (upper (letter | digit | '_')*);
|
|
|
|
TString. Type1 ::= "String";
|
|
TInt. Type1 ::= "Int";
|
|
TDouble. Type1 ::= "Double";
|
|
TChar. Type1 ::= "Char";
|
|
TCustom. Type1 ::= UIdent;
|
|
TArr. Type ::= Type1 "→" Type;
|
|
TForall. Type ::= "∀" Ident ":" Kind "." Type;
|
|
TLambda. Type ::= "λ" Ident ":" Kind "." Type;
|
|
|
|
coercions Type 1;
|
|
|
|
terminator Definition "";
|
|
|
|
terminator Ident "";
|
|
|
|
EVar. Exp4 ::= Ident;
|
|
EInt. Exp4 ::= Integer;
|
|
EDouble. Exp4 ::= Double;
|
|
EChar. Exp4 ::= Char;
|
|
EText. Exp4 ::= String;
|
|
EApp. Exp2 ::= Exp2 Exp3; -- TODO: Fix shift reduce conflicts from these
|
|
ETApp. Exp2 ::= Exp2 Type; -- TODO: Fix shift reduce conflicts from these
|
|
EAdd. Exp1 ::= Exp1 "+" Exp2;
|
|
ESub. Exp1 ::= Exp1 "-" Exp2;
|
|
ELt. Exp1 ::= Exp1 "<" Exp2;
|
|
EIf. Exp ::= "if" Exp "then" Exp "else" Exp;
|
|
ETAbs. Exp ::= "Λ" Ident ":" Kind "." Exp;
|
|
EAbs. Exp ::= "λ" Ident ":" Type "." Exp;
|
|
|
|
coercions Exp 4;
|
|
|
|
comment "--";
|
|
comment "{-" "-}";
|