blob: 86710a22cb85cc160544ad6166c42f3bd0625234 (
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 ::= AdditiveExpression | FunctionDefinition
AdditiveExpression ::= PrimaryExpression (("+" | "-") AdditiveExpression)
PrimaryExpression ::= NUMBER | IDENTIFIER | FunctionCallStatement
FunctionDefinition ::= LPAREN FunctionParamters? RPAREN ARROW LBRACE Statement* ReturnStatement SEMICOLON RBRACE
FunctionParameters ::= IDENTIFIER ("," IDENTIFIER)*
|