1 Commentable space line block = {space | line | block} ;
2 CommentLine = prefix, {_ - (↵ | eoi)} ;
3 CommentBlock = begin, {_ - end}, end ;
4 Lexeme g = g, Commentable (␣ | ↵, ␣) CommentLine CommentBlock ;
5 Parens g = Lexeme "(", g, Lexeme ")" ;
8 TypeFun = infixr TypeList (Lexeme "->") ;
9 TypeList = Lexeme "[", (Type | ""), Lexeme "]" | TypeTuple2 ;
10 TypeTuple2 = Parens (infixr Type (Lexeme ",")) | TypeApp ;
11 TypeApp = {TypeAtom}- ;
12 TypeAtom = Parens Type | TypeConst | TypeVar ;
13 TypeConst = Lexeme ModNameTy ;
14 TypeVar = Lexeme (Unicat LowercaseLetter, {Unicat_Letter | Unicat_Number}) ;
15 Term = TermAbst | TermOperators | TermLet ;
16 TermOperators = operators TermAtom TermPrefix TermInfix TermPostfix ;
17 TermAtom = teinteger | ModNameTe | TermGroup ;
18 TermGroup = Parens Term ;
19 TermAbst = Lexeme "\", {TermAbstDecl}-, Lexeme "->", Term ;
20 TermAbstDecl = Parens (NameTe, (Lexeme "::" | Lexeme ":"), Type) ;
21 TermLet = Lexeme "let", NameTe, {TermAbstDecl}, Lexeme "=", Term, Lexeme "in", Term ;
22 ModNameTe = Lexeme (ModNameTeId | Parens ModNameTeOp) ;
23 NameTe = Lexeme (NameTeId | Parens NameTeOp) ;
24 NameTeId = Unicat_Letter, {NameTeIdTail} - NameTeIdKey, (_ - NameTeIdTail) ;
25 NameTeIdTail = Unicat_Letter | Unicat_Number ;
26 NameTeIdKey = "in" | "let" ;
27 ModNameTeOp = [PathMod, "."], NameTeOp ;
28 NameTeOp = {NameTeOpOk}- - NameTeOpKey, (_ - NameTeOpOk) ;
29 NameTeOpOk = (Unicat_Symbol | Unicat_Punctuation | Unicat_Mark) - ("(" | ")" | "`" | "'" | "," | "[" | "]") ;
30 NameTeOpKey = "\" | "->" | "=" | "@" ;