added while and do-while loops

This commit is contained in:
cozis
2021-11-03 01:25:18 +00:00
parent 035649bd63
commit c0d788656e
7 changed files with 328 additions and 7 deletions
+18 -4
View File
@@ -11,6 +11,8 @@ typedef enum {
NODE_RETURN,
NODE_FUNC,
NODE_ARG,
NODE_WHILE,
NODE_DOWHILE,
} NodeKind;
typedef enum {
@@ -82,18 +84,30 @@ typedef struct {
typedef struct {
ExprNode base;
Node *func;
Node *argv;
int argc;
Node *func;
Node *argv;
int argc;
} CallExprNode;
typedef struct {
Node base;
Node base;
Node *condition;
Node *true_branch;
Node *false_branch;
} IfElseNode;
typedef struct {
Node base;
Node *condition;
Node *body;
} WhileNode;
typedef struct {
Node base;
Node *body;
Node *condition;
} DoWhileNode;
typedef struct {
Node base;
Node *head;