From e2dbc82213a6e5da74de2220eeeab78da41fb519 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Wed, 2 Feb 2022 19:22:15 -0500 Subject: Add initial support for arrays (also no testing) Usual disclaimer at this point: Quick&Dirty implementation, hasn't been tested other than basic sanity checks. Arrays are automatically decayed into pointers when the identifier is accessed. --- src/ast.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/ast.c') diff --git a/src/ast.c b/src/ast.c index 3eaaf61..f75e531 100644 --- a/src/ast.c +++ b/src/ast.c @@ -129,6 +129,12 @@ static void do_print_ast(Node *node, int depth) for (int i = 0; i < node->block.num_children; i++) { do_print_ast(node->block.children[i], depth); } + } else if (node->type == OP_DEREF) { + printf("DEREF\n"); + do_print_ast(node->unary_expr, depth + 1); + } else if (node->type == OP_ADDROF) { + printf("ADDROF\n"); + do_print_ast(node->unary_expr, depth + 1); } else if (node->type == AST_BLOCK) { printf("{\n"); for (int i = 0; i < node->block.num_children; i++) { -- cgit v1.2.3