layout toplevel ; layout "let" ; layout stop "in" ; 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 ; []. [Decl] ::= ; (:). [Decl] ::= "|" Decl [Decl]; -- todo custom [Decl] TypeFun. TypeSig ::= TypeSig1 "→" TypeSig ; TypeApp. TypeSig1 ::= Id [TypeSig2] ; TypeVar. TypeSig2 ::= Id ; coercions TypeSig 2; separator nonempty TypeSig2 "" ; ExpLet. Exp ::= "let" "{" [Assign] "}" "in" Exp2 ; ExpTyped. Exp1 ::= Exp2 ":" TypeSig ; ExpAbs. Exp2 ::= "λ" [Id] "." Exp3 ; ExpApp. Exp3 ::= Exp4 [Exp4] ; ExpVar. Exp4 ::= Id ; Assign. Assign ::= Ident "=" Exp1 ; separator nonempty Assign ";" ; separator nonempty Exp4 "" ; coercions Exp 4 ; separator nonempty Id "" ;