aboutsummaryrefslogtreecommitdiff
path: root/symtab.h
diff options
context:
space:
mode:
Diffstat (limited to 'symtab.h')
-rw-r--r--symtab.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/symtab.h b/symtab.h
new file mode 100644
index 0000000..18dd8e0
--- /dev/null
+++ b/symtab.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "symbol.h"
+#include "type.h"
+
+
+struct symtab {
+ struct symtab *parent;
+ int cap,len;
+ struct symbol **syms;
+};
+
+
+struct symtab* symtab_make();
+void symtab_delete_recursive(struct symtab *symtab);
+
+struct symbol* symtab_find(const struct symtab *symtab, const char *name);
+struct symbol* symtab_find_local(const struct symtab *symtab, const char *name);
+void symtab_insert(struct symtab *symtab, struct symbol *sym);
+
+struct symtab* symtab_root(struct symtab *symtab);
+struct symtab* symtab_sub(struct symtab *symtab);
+struct symtab* symtab_delete_get_parent(struct symtab *symtab);