hm/hm.cf

41 lines
893 B
CFEngine3
Raw Permalink Normal View History

2022-01-20 21:05:25 +01:00
layout toplevel ;
2022-01-23 12:52:33 +01:00
layout "let" ;
layout stop "in" ;
2022-01-20 21:05:25 +01:00
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 "{-" "-}" ;
2022-01-23 12:52:33 +01:00
TypeDef. Def ::= "type" TypeSig1 [Decl] ;
2022-01-20 21:05:25 +01:00
VarDef. Def ::= Id ":" TypeSig ":=" Exp ;
separator Def ";" ;
2022-01-23 12:52:33 +01:00
Decl. Decl ::= Id ":" TypeSig ;
[]. [Decl] ::= ;
(:). [Decl] ::= "|" Decl [Decl];
2022-01-20 21:05:25 +01:00
TypeFun. TypeSig ::= TypeSig1 "" TypeSig ;
2022-01-28 22:56:03 +01:00
TypeFun. TypeSig ::= TypeSig1 "->" TypeSig ;
2022-01-20 21:05:25 +01:00
TypeApp. TypeSig1 ::= Id [TypeSig2] ;
TypeVar. TypeSig2 ::= Id ;
coercions TypeSig 2;
separator nonempty TypeSig2 "" ;
ExpLet. Exp ::= "let" "{" [Assign] "}" "in" Exp1 ;
2022-01-28 22:56:03 +01:00
ExpAbs. Exp1 ::= "λ" [Id] "." Exp1 ;
ExpAbs. Exp1 ::= "\\" [Id] "." Exp1 ;
ExpApp. Exp1 ::= Exp2 [Exp2] ;
ExpVar. Exp2 ::= Id ;
2022-01-20 21:05:25 +01:00
Assign. Assign ::= Id ":=" Exp ;
2022-01-23 12:52:33 +01:00
separator nonempty Assign ";" ;
separator nonempty Exp2 "" ;
coercions Exp 2 ;
2022-01-20 21:05:25 +01:00
separator nonempty Id "" ;