blob: 65cd74e7d4131b366fd4293a3e3a818a86434c80 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
Program ::= Statement+
Statement ::= (AssignmentStatement | PrintStatement | FunctionCallStatement) SEMICOLON
AssignmentStatement ::= "let" IDENTIFIER EQUALS Expression
PrintStatement ::= PRINT LPAREN Expression RPAREN -- TODO: this won't be needed once functions support arguments
FunctionCallStatement ::= IDENTIFIER LPAREN RPAREN
Expression ::= AdditiveExpression | FunctionDefinition
AdditiveExpression ::= PrimaryExpression ("+" AdditiveExpression)
PrimaryExpression ::= NUMBER | IDENTIFIER | FunctionCallStatement
FunctionDefinition ::= ARROW LBRACE Statement* ReturnStatement RBRACE
ReturnStatement ::= RETURN Expression SEMICOLON --TODO: I dont like this
|