hm/hm.cf

33 lines
671 B
CFEngine3
Raw Normal View History

2022-01-20 21:05:25 +01:00
layout toplevel ;
entrypoints [Def], Exp ;
2022-01-20 21:14:03 +01:00
token Id ((letter|digit|["[]_"])+) ;
2022-01-20 21:05:25 +01:00
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 "" ;