From 081d59d0003970871ab7f0751a44c84a2a443670 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind?= Date: Sun, 13 Feb 2022 17:40:54 +0100 Subject: [PATCH] Initial file --- exercises/02/vslc/include/ir.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 exercises/02/vslc/include/ir.h diff --git a/exercises/02/vslc/include/ir.h b/exercises/02/vslc/include/ir.h new file mode 100644 index 0000000..fe2fbf4 --- /dev/null +++ b/exercises/02/vslc/include/ir.h @@ -0,0 +1,23 @@ +#ifndef IR_H +#define IR_H + +/* This is the tree node structure */ +typedef struct n { + node_index_t type; // Type of the node + void *data; // Pointer to associated data + struct s *entry; // Pointer to symtab entry (ignore for now) + uint64_t n_children; // Number of child nodes + struct n **children; // Array of n_children child nodes +} node_t; + +/**Export the initializer function, it is needed by the parser + * @param *nd node to initialize + * @param type type of node (see nodetype.h) + * @param *data associated data. Declared void to allow any type + * @param n_children number of children + * @param ... variable argument list of child nodes (node_t *) + * */ +void node_init ( + node_t *nd, node_index_t type, void *data, uint64_t n_children, ... +); +#endif