summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-21 23:54:17 +0100
committerBaitinq <manuelpalenzuelamerino@gmail.com>2025-01-21 23:54:17 +0100
commit5965c25a1b32599c8b95e8713b8002e11b891ba4 (patch)
treefda0d378008c0b89ef1ff1453bd4e2a4ba80b1fe /grammar.ebnf
parentTokenizer: Rename NOT token to BANG (diff)
downloadinterpreter-5965c25a1b32599c8b95e8713b8002e11b891ba4.tar.gz
interpreter-5965c25a1b32599c8b95e8713b8002e11b891ba4.tar.bz2
interpreter-5965c25a1b32599c8b95e8713b8002e11b891ba4.zip
Feature: Add support for while statements
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf4
1 files changed, 3 insertions, 1 deletions
diff --git a/grammar.ebnf b/grammar.ebnf
index 1af657b..890ba2d 100644
--- a/grammar.ebnf
+++ b/grammar.ebnf
@@ -1,6 +1,6 @@
 Program      ::= Statement+
 
-Statement    ::= (AssignmentStatement | FunctionCallStatement | IfStatement | ReturnStatement) SEMICOLON
+Statement    ::= (AssignmentStatement | FunctionCallStatement | IfStatement | WhileStatement | ReturnStatement) SEMICOLON
 
 AssignmentStatement ::= "let" IDENTIFIER EQUALS Expression
 
@@ -8,6 +8,8 @@ FunctionCallStatement ::= IDENTIFIER LPAREN FunctionArguments? RPAREN
 
 IfStatement ::= "if" Expression LBRACE Statement* RBRACE -- TODO: Should function definitions be allowed?
 
+WhileStatement ::= "while" Expression LBRACE Statement* RBRACE
+
 ReturnStatement ::= RETURN Expression
 
 FunctionArguments ::= Expression ("," Expression)*