diff --git a/src/ast.rs b/src/ast.rs index f6752dd..bb580a2 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -25,6 +25,11 @@ pub enum StmtNode { then_branch: Box, else_branch: Option>, }, + /// While loop statement. + WhileStmt { + condition: ExprNode, + body: Box, + }, } /// An AST node that represents an expression. @@ -110,6 +115,10 @@ impl AstDumper for StmtNode { stmt.dump() ), }, + + Self::WhileStmt { condition, body } => { + format!("( while {} {} )", condition.dump(), body.dump()) + } } } }