grammar SimpleDeclarative; function : WORD COLON 'function' expression(ARROW expression)? setFuncBody SEMICOLON; setFuncBody : BRACESTART BRACEEND | BRACESTART expression ARROW expression (COMMA expression ARROW expression)* BRACEEND; ; set : BRACESTART BRACEEND | '{' set_member (COMMA set_member)* BRACEEND; set_member: (atom COLON)=> atom COLON expression (OR expression)* | (expression EQUAL)=> equation | expression; expression : (LET set)? (atom | set) (WHERE set)?; equation : expression EQUAL expression; atom : WORD | NUMBER; WHERE : 'where'; LET : 'let'; EQUAL : '='; SEMICOLON: ';'; OR : '|'; COLON : ':'; ARROW : '->'; BRACESTART : '{'; BRACEEND : '}'; COMMA : ','; NUMBER : (DIGIT)+ ; WORD : (LETTER)+; fragment DIGIT : '0'..'9' ; fragment LETTER : 'a'..'z'; WHITESPACE : ( '\t' | ' ' | '\r' | '\n'| '\u000C' )+ { $channel = HIDDEN; } ;