#ifndef MK_SYMTABLE_H #define MK_SYMTABLE_H #include "commons.h" #include "vec.h" struct entry { char* name; size_t addr; bool is_local; }; struct env { struct vec entries; struct env* parent; }; struct symtable { struct env* root; }; void entry_init(struct entry* self, char const* name, size_t addr, bool is_local); void entry_free(struct entry* self); void env_init(struct env* self, struct env* parent); void env_free(struct env* self); struct entry* env_try_get(struct env* self, char* name); void symtable_init(struct symtable* self); void symtable_free(struct symtable* self); void symtable_declare(struct symtable* self, char* name, size_t addr, bool is_local); struct entry* symtable_try_get(struct symtable* self, char* name); #endif