summaryrefslogtreecommitdiff
path: root/ast.h
diff options
context:
space:
mode:
authorCarson Fleming <cflems@cflems.net>2026-07-18 22:34:54 -0700
committerCarson Fleming <cflems@cflems.net>2026-07-18 22:46:47 -0700
commitfeb1cac139ca5aa2ba76ac6a0a318bced03d8638 (patch)
treee107f774e08daed3dedd5d39345d2b725b2d171d /ast.h
parent385419f95c6b9c35a7c2a6168f82f7aa4a44e22b (diff)
downloadccc-feb1cac139ca5aa2ba76ac6a0a318bced03d8638.tar.gz
loop support
Diffstat (limited to 'ast.h')
-rw-r--r--ast.h10
1 files changed, 10 insertions, 0 deletions
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;