ps3: task 1

This commit is contained in:
2026-02-23 16:16:32 +01:00
parent 3e99c78d9b
commit f50045c6ad
+17 -1
View File
@@ -173,7 +173,23 @@ static node_t* simplify_subtree(node_t* node)
if (node == NULL)
return node;
// TODO: Task 1: Implement this function by calling the above functions when applicable
for (int i = 0; i < node->n_children; i++) {
node_t *child = node->children[i];
simplify_subtree(child);
}
switch (node->type) {
case OPERATOR:
convert_operator(node);
break;
case PRINTLN_STATEMENT:
simplify_println_statement(node);
break;
case BLOCK:
flatten_variable_declarations(node);
break;
}
return node;
}