diff options
| author | Cori Barker <coribarker2@gmail.com> | 2026-02-05 09:32:20 +0000 |
|---|---|---|
| committer | Cori Barker <coribarker2@gmail.com> | 2026-02-05 09:32:20 +0000 |
| commit | ddedc416185954051ff2a826c24fc1cc608204f1 (patch) | |
| tree | 4dca1a13fc43ab9eb8c415aa116c02c8c543d074 /include/semantic/symbol_table.h | |
| parent | 44eb8234648bfd6c4607d4fd0d804bbfb9168589 (diff) | |
Written some class declarations for the semantics, updated README
Diffstat (limited to 'include/semantic/symbol_table.h')
| -rw-r--r-- | include/semantic/symbol_table.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/include/semantic/symbol_table.h b/include/semantic/symbol_table.h new file mode 100644 index 0000000..b2b8270 --- /dev/null +++ b/include/semantic/symbol_table.h @@ -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; +}; |
