aboutsummaryrefslogtreecommitdiffstats
path: root/src/nodes.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2022-04-08 08:25:48 -0300
committerBad Diode <bd@badd10de.dev>2022-04-08 08:25:48 -0300
commit55ecfb3b7713172f76ddbff022fa4d6a80d0661a (patch)
tree6a6baae20d67824d5f79b801b27f58cc967a3ba1 /src/nodes.c
parent9f934cbc0f0fd60a6938ac1c4c84edc270de94ca (diff)
downloadbdl-55ecfb3b7713172f76ddbff022fa4d6a80d0661a.tar.gz
bdl-55ecfb3b7713172f76ddbff022fa4d6a80d0661a.zip
Add initial implementation of AST vizualization
Diffstat (limited to 'src/nodes.c')
-rw-r--r--src/nodes.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/nodes.c b/src/nodes.c
index 5689d18..35d123a 100644
--- a/src/nodes.c
+++ b/src/nodes.c
@@ -1,10 +1,13 @@
1#include "nodes.h" 1#include "nodes.h"
2 2
3static size_t node_gen_id = 0;
4
3Node * 5Node *
4alloc_node(NodeType type) { 6alloc_node(NodeType type) {
5 // TODO: Use a bump allocator? 7 // TODO: Use a bump allocator?
6 // TODO: Free memory! 8 // TODO: Free memory!
7 Node *node = malloc(sizeof(Node)); 9 Node *node = malloc(sizeof(Node));
10 node->id = node_gen_id++;
8 node->type = type; 11 node->type = type;
9 node->line = 0; 12 node->line = 0;
10 node->col = 0; 13 node->col = 0;