aboutsummaryrefslogtreecommitdiff
path: root/symtab.h
blob: 18dd8e0ed354f5510c2de7d1ac96c6e4ecaf2646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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);