%
% This file is automatically generated from 02-grammar.json using gendoc.py.
% Do not edit by hand.
%
\production{\nonterminal{start}}{
(\nonterminal{definition})*
}
\production{\nonterminal{definition}}{
\nonterminal{defProgram}
\ALT
\nonterminal{defInteractiveProgram}
\ALT
\nonterminal{defProcedure}
\ALT
\nonterminal{defFunction}
\ALT
\nonterminal{defType}
}
\production{\nonterminal{defProgram}}{
\token{PROGRAM} \nonterminal{stmtBlock}
}
\production{\nonterminal{defInteractiveProgram}}{
\token{INTERACTIVE} \token{PROGRAM} (\nonterminal{stmtSwitchBranch})* \token{RBRACE}
}
\production{\nonterminal{defProcedure}}{
\token{PROCEDURE} \token{LPAREN} \nonterminal{loweridSeq} \token{RPAREN} \nonterminal{stmtBlock}
}
\production{\nonterminal{defFunction}}{
\token{FUNCTION} \token{LPAREN} \nonterminal{loweridSeq} \token{RPAREN} \nonterminal{stmtBlock}
}
\production{\nonterminal{defType}}{
\token{FUNCTION} \token{LPAREN} \nonterminal{loweridSeq} \token{RPAREN} \nonterminal{stmtBlock}
\ALT
\token{TYPE} \token{UPPERID} \token{IS} \token{RECORD} \token{LBRACE} (\nonterminal{fieldDeclaration})* \token{RBRACE}
\ALT
\token{TYPE} \token{UPPERID} \token{IS} \token{VARIANT} \token{LBRACE} (\nonterminal{constructorDeclaration})* \token{RBRACE}
}
\production{\nonterminal{constructorDeclaration}}{
\token{CASE} \token{UPPERID} \token{LBRACE} (\nonterminal{fieldDeclaration})* \token{RBRACE}
}
\production{\nonterminal{fieldDeclaration}}{
\token{FIELD} \token{LOWERID}
}
\production{\nonterminal{loweridSeq}}{
\EMPTY
\ALT
\nonterminal{\nonEmpty{loweridSeq}}
}
\production{\nonterminal{\nonEmpty{loweridSeq}}}{
\token{LOWERID} (\token{COMMA} \nonterminal{\nonEmpty{loweridSeq}})?
}
\production{\nonterminal{statement}}{
\nonterminal{stmtEllipsis}
\ALT
\nonterminal{stmtBlock}
\ALT
\nonterminal{stmtReturn}
\ALT
\nonterminal{stmtIf}
\ALT
\nonterminal{stmtRepeat}
\ALT
\nonterminal{stmtForeach}
\ALT
\nonterminal{stmtWhile}
\ALT
\nonterminal{stmtSwitch}
\ALT
\nonterminal{stmtLet}
\ALT
\nonterminal{stmtVariableAssignment}
\ALT
\nonterminal{stmtProcedureCall}
}
\production{\nonterminal{stmtEllipsis}}{
\token{ELLIPSIS}
}
\production{\nonterminal{stmtBlock}}{
\token{LBRACE} (\nonterminal{statement} (\token{SEMICOLON})?)* \token{RBRACE}
}
\production{\nonterminal{stmtReturn}}{
\token{RETURN} \token{LPAREN} \nonterminal{\nonEmpty{expressionSeq}} \token{RPAREN}
}
\production{\nonterminal{stmtIf}}{
\token{IF} \nonterminal{stmtIfBranch} (\token{ELSEIF} \nonterminal{stmtIfBranch})* (\token{ELSE} \nonterminal{stmtBlock})?
}
\production{\nonterminal{stmtIfBranch}}{
\token{LPAREN} \nonterminal{expression} \token{RPAREN} (\token{THEN})? \nonterminal{stmtBlock}
}
\production{\nonterminal{stmtRepeat}}{
\token{REPEAT} \token{LPAREN} \nonterminal{expression} \token{RPAREN} \nonterminal{stmtBlock}
}
\production{\nonterminal{stmtForeach}}{
\token{FOREACH} \nonterminal{pattern} \token{IN} \nonterminal{expression} \nonterminal{stmtBlock}
}
\production{\nonterminal{stmtWhile}}{
\token{WHILE} \token{LPAREN} \nonterminal{expression} \token{RPAREN} \nonterminal{stmtBlock}
}
\production{\nonterminal{stmtSwitch}}{
\token{SWITCH} \token{LPAREN} \nonterminal{expression} \token{RPAREN} (\token{TO})? \token{LBRACE} (\nonterminal{stmtSwitchBranch})* \token{RBRACE}
}
\production{\nonterminal{stmtSwitchBranch}}{
\nonterminal{pattern} \token{ARROW} \nonterminal{stmtBlock}
}
\production{\nonterminal{stmtLet}}{
\token{LET} \nonterminal{stmtVariableAssignment}
\ALT
\token{LET} \nonterminal{stmtTupleAssignment}
}
\production{\nonterminal{stmtVariableAssignment}}{
\token{LOWERID} \token{ASSIGN} \nonterminal{expression}
}
\production{\nonterminal{stmtTupleAssignment}}{
\token{LPAREN} \token{RPAREN} \token{ASSIGN} \nonterminal{expression}
\ALT
\token{LPAREN} \token{LOWERID} \token{COMMA} \nonterminal{\nonEmpty{loweridSeq}} \token{RPAREN} \token{ASSIGN} \nonterminal{expression}
}
\production{\nonterminal{stmtProcedureCall}}{
\token{UPPERID} \token{LPAREN} \nonterminal{expressionSeq} \token{RPAREN}
}
\production{\nonterminal{pattern}}{
\nonterminal{patternWildcard}
\ALT
\nonterminal{patternVariable}
\ALT
\nonterminal{patternNumber}
\ALT
\nonterminal{patternStructure}
\ALT
\nonterminal{patternTuple}
\ALT
\nonterminal{patternTimeout}
}
\production{\nonterminal{patternWildcard}}{
\token{UNDERSCORE}
}
\production{\nonterminal{patternVariable}}{
\token{LOWERID}
}
\production{\nonterminal{patternNumber}}{
\token{NUM}
\ALT
\token{MINUS} \token{NUM}
}
\production{\nonterminal{patternStructure}}{
\token{UPPERID} (\token{LPAREN} \nonterminal{loweridSeq} \token{RPAREN})?
}
\production{\nonterminal{patternTuple}}{
\token{LPAREN} \token{RPAREN}
\ALT
\token{LPAREN} \token{LOWERID} \token{COMMA} \nonterminal{\nonEmpty{loweridSeq}} \token{RPAREN}
}
\production{\nonterminal{patternTimeout}}{
\token{TIMEOUT} \token{LPAREN} \token{NUM} \token{RPAREN}
}
\production{\nonterminal{expression}}{
\nonterminal{exprAtom}
\ALT
\nonterminal{expression} \nonterminal{infixOperator} \nonterminal{expression}
\ALT
\nonterminal{prefixOperator} \nonterminal{expression}
\ALT
\token{LPAREN} \nonterminal{expression} \token{RPAREN}
}
\production{\nonterminal{exprAtom}}{
\nonterminal{exprEllipsis}
\ALT
\nonterminal{exprVariable}
\ALT
\nonterminal{exprFunctionCall}
\ALT
\nonterminal{exprConstantNumber}
\ALT
\nonterminal{exprConstantString}
\ALT
\nonterminal{exprChoose}
\ALT
\nonterminal{exprMatching}
\ALT
\nonterminal{exprList}
\ALT
\nonterminal{exprRange}
\ALT
\nonterminal{exprTuple}
\ALT
\nonterminal{exprStructure}
\ALT
\nonterminal{exprStructureUpdate}
}
\production{\nonterminal{exprEllipsis}}{
\token{ELLIPSIS}
}
\production{\nonterminal{exprVariable}}{
\token{LOWERID}
}
\production{\nonterminal{exprFunctionCall}}{
\token{LOWERID} \token{LPAREN} \nonterminal{expressionSeq} \token{RPAREN}
}
\production{\nonterminal{exprConstantNumber}}{
\token{NUM}
}
\production{\nonterminal{exprConstantString}}{
\token{STRING}
}
\production{\nonterminal{exprChoose}}{
\token{CHOOSE} (\nonterminal{expression} \token{WHEN} \token{LPAREN} \nonterminal{expression} \token{RPAREN})* \nonterminal{expression} \token{OTHERWISE}
}
\production{\nonterminal{exprMatching}}{
\token{MATCHING} \nonterminal{expression} \token{SELECT} (\nonterminal{expression} \token{ON} \nonterminal{pattern})* \nonterminal{expression} \token{OTHERWISE}
}
\production{\nonterminal{exprList}}{
\token{LBRACK} \nonterminal{expressionSeq} \token{RBRACK}
}
\production{\nonterminal{exprRange}}{
\token{LBRACK} \nonterminal{expression} \token{RANGE} \nonterminal{expression} \token{RBRACK}
\ALT
\token{LBRACK} \nonterminal{expression} \token{COMMA} \nonterminal{expression} \token{RANGE} \nonterminal{expression} \token{RBRACK}
}
\production{\nonterminal{exprTuple}}{
\token{LPAREN} \token{RPAREN}
\ALT
\token{LPAREN} \nonterminal{expression} \token{COMMA} \nonterminal{\nonEmpty{expressionSeq}} \token{RPAREN}
}
\production{\nonterminal{exprStructure}}{
\token{UPPERID} (\token{LPAREN} \nonterminal{fieldBindingSeq} \token{RPAREN})?
}
\production{\nonterminal{exprStructureUpdate}}{
\token{UPPERID} \token{LPAREN} \nonterminal{expression} \token{PIPE} \nonterminal{fieldBindingSeq} \token{RPAREN}
}
\production{\nonterminal{fieldBinding}}{
\token{LOWERID} \token{GETS} \nonterminal{expression}
}
\production{\nonterminal{fieldBindingSeq}}{
\EMPTY
\ALT
\nonterminal{\nonEmpty{fieldBindingSeq}}
}
\production{\nonterminal{\nonEmpty{fieldBindingSeq}}}{
\nonterminal{fieldBinding} (\token{COMMA} \nonterminal{\nonEmpty{fieldBindingSeq}})?
}
\production{\nonterminal{infixOperator}}{
\token{OR}
\ALT
\token{AND}
\ALT
\token{EQ}
\ALT
\token{NE}
\ALT
\token{LE}
\ALT
\token{GE}
\ALT
\token{LT}
\ALT
\token{GT}
\ALT
\token{CONCAT}
\ALT
\token{PLUS}
\ALT
\token{MINUS}
\ALT
\token{TIMES}
\ALT
\token{DIV}
\ALT
\token{MOD}
\ALT
\token{POW}
}
\production{\nonterminal{prefixOperator}}{
\token{MINUS}
\ALT
\token{NOT}
}
\production{\nonterminal{expressionSeq}}{
\EMPTY
\ALT
\nonterminal{\nonEmpty{expressionSeq}}
}
\production{\nonterminal{\nonEmpty{expressionSeq}}}{
\nonterminal{expression} (\token{COMMA} \nonterminal{\nonEmpty{expressionSeq}})?
}
%
% This file is automatically generated from 02-grammar.json using gendoc.py.
% Do not edit by hand.
%
