From 60c0e084b159801a45570b56f152f0f5e9193d72 Mon Sep 17 00:00:00 2001 From: hachem Date: Tue, 8 Sep 2026 12:16:51 +0200 Subject: feat: add while loops --- src/ast.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ast.h') diff --git a/src/ast.h b/src/ast.h index 074c9b2..f5eea17 100644 --- a/src/ast.h +++ b/src/ast.h @@ -115,6 +115,7 @@ enum StatementKind STATEMENT_GOTO, STATEMENT_SYSCALL, STATEMENT_IF, + STATEMENT_WHILE, STATEMENT_CALL, STATEMENT_STACK, }; @@ -149,6 +150,15 @@ struct IfStatement size_t else_count; }; +struct WhileStatement +{ + struct Expr* left; + struct Token comparison; + struct Expr* right; + struct Statement* body; + size_t body_count; +}; + struct CallStatement { struct Token name; @@ -172,6 +182,7 @@ struct Statement struct LabelStatement label; struct GotoStatement jump; struct IfStatement branch; + struct WhileStatement loop; struct CallStatement call; struct StackStatement stack; }; -- cgit v1.3