2025-03-05 15:45:19 +08:00

19 lines
507 B
C

// symtab.h
#ifndef __SYMTAB_H__
#define __SYMTAB_H__
struct SymbolTable {
struct Scope* cur_scope;
struct Scope* global_scope;
};
void init_symtab(struct SymbolTable* symtab);
void del_symtab(struct SymbolTable* symtab);
void symtab_enter_scope(struct SymbolTable* symtab);
void symtab_leave_scope(struct SymbolTable* symtab);
void symtab_add_symbol(struct SymbolTable* symtab, const char* name, void* ast_node);
void* symtab_lookup_symbol(struct SymbolTable* symtab, const char* name);
#endif