diff options
Diffstat (limited to 'grammar.ebnf')
-rw-r--r-- | grammar.ebnf | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/grammar.ebnf b/grammar.ebnf index 65cd74e..406c2d0 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -6,7 +6,9 @@ AssignmentStatement ::= "let" IDENTIFIER EQUALS Expression PrintStatement ::= PRINT LPAREN Expression RPAREN -- TODO: this won't be needed once functions support arguments -FunctionCallStatement ::= IDENTIFIER LPAREN RPAREN +FunctionCallStatement ::= IDENTIFIER LPAREN FunctionArguments? RPAREN + +FunctionArguments ::= Expression ("," Expression)* Expression ::= AdditiveExpression | FunctionDefinition @@ -14,6 +16,8 @@ AdditiveExpression ::= PrimaryExpression ("+" AdditiveExpression) PrimaryExpression ::= NUMBER | IDENTIFIER | FunctionCallStatement -FunctionDefinition ::= ARROW LBRACE Statement* ReturnStatement RBRACE +FunctionDefinition ::= LPAREN FunctionParamters? RPAREN ARROW LBRACE Statement* ReturnStatement RBRACE + +FunctionParameters ::= IDENTIFIER ("," IDENTIFIER)* ReturnStatement ::= RETURN Expression SEMICOLON --TODO: I dont like this |