Humus Grammar
This grammar describes the syntax of Humus in terms of tokens, ignoring whitespace and comments.
repl = stmt+ block = '[' stmt* ']' stmt = 'DEF' ptrn 'AS' expr | 'LET' eqtn | ('AFTER' expr)? 'SEND' expr 'TO' expr | 'CREATE' ident 'WITH' expr | 'BECOME' expr | 'THROW' expr | expr expr = 'CASE' expr 'OF' (ptrn ':' expr)+ 'END' | 'IF' eqtn expr ('ELIF' eqtn expr)* ('ELSE' expr)? | 'LET' eqtn 'IN' expr | term ',' expr | term term = const | call | ident | 'NEW' term | '(' expr? ')' call = ident '(' expr? ')' | '(' expr ')' '(' expr? ')' eqtn = ptrn '=' ptrn | ident '(' ptrn? ')' '=' expr ptrn = pterm ',' ptrn | pterm pterm = '_' | const | ident | '$' term | '(' ptrn? ')' const = block | 'SELF' | '\' ptrn '.' expr | number | '?' | 'NIL' | 'TRUE' | 'FALSE' | '#' token