blob: ff20542709e92862e2c4308c2ac091b761e21313 (
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 <string>
#include <memory>
class Scope {
public:
explicit Scope(std::string name, int level, *Scope parent);
std::string getScopeName();
int getScopeLevel();
*Scope getParentScope();
void define(Symbol symbol);
*Symbol lookup(std::string name);
bool isDeclared(std::string name);
std::unordered_map<std::string, Symbol> getAllSymbols();
std::string toString();
private:
std::string scope_name;
int scope_level
*Scope parent_scope;
std::unordered_map<std::string, Symbol> symbols;
};
|