-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSymbolTable.h
More file actions
36 lines (26 loc) · 734 Bytes
/
SymbolTable.h
File metadata and controls
36 lines (26 loc) · 734 Bytes
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
26
27
28
29
30
31
32
33
34
35
36
#ifndef SYMBOL_TABLE_H
#define SYMBOL_TABLE_H
struct FuncMeta;
typedef shared_ptr<FuncMeta> FuncMetaPtr;
class SymbolTable {
public:
static SymbolTable* topTable();
static void pushTable(FuncMetaPtr &meta);
static void popTable();
SymbolTable(FuncMetaPtr &meta);
~SymbolTable();
FuncMetaPtr& getMeta();
void pushBlock();
void popBlock();
pair<int, int> getLocalOffSize();
void declareLocal(const string& name);
int getLocalIdx(const string& name);
int getMaxLocalIdx() const { return m_maxLocalIdx; }
private:
FuncMetaPtr m_meta;
vector<map<string, int> > m_blockNames;
int m_maxLocalIdx;
int m_curLocalIdx;
static vector<SymbolTable*> s_tables;
};
#endif