diff options
| author | Mustafa Quraish <[email protected]> | 2022-02-02 19:22:15 -0500 |
|---|---|---|
| committer | Mustafa Quraish <[email protected]> | 2022-02-02 19:22:15 -0500 |
| commit | e2dbc82213a6e5da74de2220eeeab78da41fb519 (patch) | |
| tree | 7f6d9a40fde00ec761e100a92bd93f555725d56c /src/ast.c | |
| parent | Move type-related stuff to a separate file (diff) | |
| download | cup-e2dbc82213a6e5da74de2220eeeab78da41fb519.tar.xz cup-e2dbc82213a6e5da74de2220eeeab78da41fb519.zip | |
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.
Diffstat (limited to 'src/ast.c')
| -rw-r--r-- | src/ast.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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++) { |