From feb1cac139ca5aa2ba76ac6a0a318bced03d8638 Mon Sep 17 00:00:00 2001 From: Carson Fleming Date: Sat, 18 Jul 2026 22:34:54 -0700 Subject: loop support --- ast.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'ast.h') diff --git a/ast.h b/ast.h index 6ff95df..71c400c 100644 --- a/ast.h +++ b/ast.h @@ -139,6 +139,14 @@ struct if_node { struct scope* scope; }; +struct loop_node { + struct expr_node* init; /* null if absent */ + struct expr_node* cond; /* null if absent */ + struct expr_node* incr; /* null if absent */ + struct stmt_node* body; + struct scope* scope; +}; + struct stmt_node { enum { STMT_EMPTY, @@ -147,6 +155,7 @@ struct stmt_node { STMT_RETURN, STMT_GROUP, STMT_IF, + STMT_LOOP, } type; union { struct expr_node expr; @@ -154,6 +163,7 @@ struct stmt_node { struct return_node return_; struct group_node group; struct if_node if_; + struct loop_node loop; } inner; struct stmt_node* next; -- cgit v1.2.3