33 lines
671 B
CFEngine3
33 lines
671 B
CFEngine3
layout toplevel ;
|
|
|
|
entrypoints [Def], Exp ;
|
|
|
|
token Id ((letter|digit|["[]_"])+) ;
|
|
|
|
comment "--" ;
|
|
comment "{-" "-}" ;
|
|
|
|
TypeDef. Def ::= "type" TypeSig1 "|" [Decl] ;
|
|
VarDef. Def ::= Id ":" TypeSig ":=" Exp ;
|
|
separator Def ";" ;
|
|
|
|
Decl. Decl ::= Id ":" TypeSig ;
|
|
separator nonempty Decl "|" ;
|
|
|
|
TypeFun. TypeSig ::= TypeSig1 "→" TypeSig ;
|
|
TypeApp. TypeSig1 ::= Id [TypeSig2] ;
|
|
TypeVar. TypeSig2 ::= Id ;
|
|
coercions TypeSig 2;
|
|
|
|
separator nonempty TypeSig2 "" ;
|
|
|
|
ExpTyped. Exp ::= Exp1 ":" TypeSig ;
|
|
ExpAbs. Exp1 ::= "λ" [Id] "." Exp2 ;
|
|
ExpApp. Exp2 ::= Exp3 [Exp3] ;
|
|
ExpVar. Exp3 ::= Id ;
|
|
|
|
separator nonempty Exp3 "" ;
|
|
coercions Exp 3;
|
|
|
|
separator nonempty Id "" ;
|