diff options
| author | Cori Barker <coribarker2@gmail.com> | 2026-02-09 11:59:14 +0000 |
|---|---|---|
| committer | Cori Barker <coribarker2@gmail.com> | 2026-02-09 11:59:14 +0000 |
| commit | b3f83360282bfe327c0ccbeecab706e0e7d2c050 (patch) | |
| tree | 1ab29e9ebbf3d3f2fb66f59cbbc687451f8da62e /include/semantic/symbol_table.hpp | |
| parent | 26738e6c932038ea309a5dbaa9e941fc1ce144b8 (diff) | |
Changed .h to .hpp
Diffstat (limited to 'include/semantic/symbol_table.hpp')
| -rw-r--r-- | include/semantic/symbol_table.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/semantic/symbol_table.hpp b/include/semantic/symbol_table.hpp new file mode 100644 index 0000000..b2b8270 --- /dev/null +++ b/include/semantic/symbol_table.hpp @@ -0,0 +1,25 @@ +#pragma once + +class SymbolTable { +public: + explicit SymbolTable(); + ~SymbolTable() = default; + void enterScope(std::string scope_name); + void exitScope(); + Scope* getCurrentScope(); + Scope* getGlobalScope(); + int getScopeLevel(); + void insert(Symbol symbol); + Symbol* lookup(std::string name); + Symbol* lookupCurrentScope(std::string name); + bool isDeclared(std::string name); + bool isDeclaredInCurrentScope(std::string name); + void display(); + std::string toString(); + +private: + std::vector<std::unique_ptr<Scope>> scopes; + Scope* current_scope; + int scope_level; + Scope* global_scope; +}; |
