add while loop

This commit is contained in:
Andrew Kelley
2015-12-24 14:37:43 -07:00
parent 2e74889c3c
commit a030b60aeb
7 changed files with 99 additions and 2 deletions

View File

@@ -45,6 +45,7 @@ enum NodeType {
NodeTypeVoid,
NodeTypeBoolLiteral,
NodeTypeIfExpr,
NodeTypeWhileExpr,
NodeTypeLabel,
NodeTypeGoto,
NodeTypeAsmExpr,
@@ -220,6 +221,11 @@ struct AstNodeIfExpr {
AstNode *else_node; // null, block node, or other if expr node
};
struct AstNodeWhileExpr {
AstNode *condition;
AstNode *body;
};
struct AstNodeLabel {
Buf name;
};
@@ -334,6 +340,7 @@ struct AstNode {
AstNodeArrayAccessExpr array_access_expr;
AstNodeUse use;
AstNodeIfExpr if_expr;
AstNodeWhileExpr while_expr;
AstNodeLabel label;
AstNodeGoto go_to;
AstNodeAsmExpr asm_expr;