-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbolTable.h
More file actions
42 lines (25 loc) · 1.15 KB
/
SymbolTable.h
File metadata and controls
42 lines (25 loc) · 1.15 KB
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
37
38
39
40
41
42
#ifndef REPL_SYMBOLTABLE_H
#define REPL_SYMBOLTABLE_H
#include <unordered_map>
#include "ASTNode.h"
#include "Identifier.h"
class SymbolTable {
private:
std::unordered_map<std::string, Identifier> symbolTable;
std::unordered_map<std::string, DeclFuncNode*> funcSymbolTable;
public:
bool isIdExist(const std::string& identifierName) const;
void addNewIdentifier(const std::string& name);
void addNewIdentifier(const std::string& name, bool value);
void addNewIdentifier(const std::string& name, double value);
void setIdValueDouble(const std::string& identifierName, double value);
void setIdValueBool(const std::string& identifierName, bool value);
double getIdValueDouble(const std::string& identifierName) const;
bool getIdValueBool(const std::string& identifierName) const;
ValueType::Type getIdValueType(const std::string& identifierName) const;
bool isFuncExist(const std::string& funcName);
void addNewFunc(DeclFuncNode* funcDecl);
DeclFuncNode* getFunc(const std::string& funcName) const;
ValueType::Type getFuncValueType(const std::string& funcName) const;
};
#endif //REPL_SYMBOLTABLE_H