blob: b2b8270100fe2bdbf38f0c539e2d51f3384cdbea (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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;
};
|