blob: bde99cbd1488b578473f26890f1dfe9dde12d1f7 (
plain) (
tree)
|
|
Program ::= Statement+
Statement ::= (AssignmentStatement | FunctionCallStatement | IfStatement | ReturnStatement) SEMICOLON
AssignmentStatement ::= "let" IDENTIFIER EQUALS Expression
FunctionCallStatement ::= IDENTIFIER LPAREN FunctionArguments? RPAREN
IfStatement ::= "if" Expression LBRACE Statement* RBRACE -- TODO: Should function definitions be allowed?
ReturnStatement ::= RETURN Expression
FunctionArguments ::= Expression ("," Expression)*
Expression ::= EqualityExpression | AdditiveExpression | FunctionDefinition | LPAREN Expression RPAREN
EqualityExpression ::= AdditiveExpression "==" AdditiveExpression
AdditiveExpression ::= PrimaryExpression (("+" | "-") AdditiveExpression)?
PrimaryExpression ::= NUMBER | BOOLEAN | IDENTIFIER | FunctionCallStatement
FunctionDefinition ::= LPAREN FunctionParamters? RPAREN ARROW LBRACE Statement* ReturnStatement SEMICOLON RBRACE
FunctionParameters ::= IDENTIFIER ("," IDENTIFIER)*
|