Added while loop

This commit is contained in:
Marvin Kaiser
2020-01-13 16:00:42 +01:00
parent 33215a1b4a
commit bd4ae1d605
15 changed files with 428 additions and 299 deletions

View File

@@ -26,6 +26,7 @@ statement
| variable_declaration
| variable_assignment
| return_statement
| whileLoop
;
print
@@ -79,12 +80,17 @@ arguments
: (expression (COMMA expression)*)?
;
whileLoop
: WHILE OPAR cond = expression CPAR braced_block
;
PRINT: 'print';
IF: 'if';
ELSE: 'else';
FUNC: 'function';
RETURN: 'return';
LET: 'let';
WHILE: 'while';
SCOL: ';';
OBRK: '{';