summary refs log tree commit diff
path: root/grammar.ebnf
blob: 5340ba4fa849dce619ce26c931363a2a0e5e2f17 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
Program ::= Statement+

Statement ::= (VariableStatement | PrintStatement | ReturnStatement) SEMICOLON

VariableStatement ::= ("let" IDENTIFIER | IDENTIFIER) EQUALS Expression

PrintStatement :== PRINT LPAREN Expression RPAREN

ReturnStatement :== RETURN Expression

Expression :== NUMBER | IDENTIFIER | Expression + Expression