From ac7ceaab9b489f9ee93d2b9bf648f902833bab58 Mon Sep 17 00:00:00 2001 From: Filleo Date: Wed, 15 May 2024 10:41:08 +0200 Subject: [PATCH] added while to the syntax tree --- src/yacc/parser.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/yacc/parser.y b/src/yacc/parser.y index db70070..811f222 100644 --- a/src/yacc/parser.y +++ b/src/yacc/parser.y @@ -314,7 +314,10 @@ branchhalf: branchif { AST_NODE_PTR branch = AST_new_node(AST_Stmt, NULL); $$ = $1; } -while: KeyWhile expr '{' statementlist '}' { DEBUG("while"); }; +while: KeyWhile expr '{' statementlist '}' {AST_NODE_PTR whilenode = AST_new_node(AST_While, NULL); + AST_push_node(whilenode, $2); + AST_push_node(whilenode, $4); + $$ = whilenode;}; identlist: Ident ',' identlist {AST_NODE_PTR ident = AST_new_node(AST_Ident, $1); AST_push_node($3, ident);