-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsymbol.hh
More file actions
34 lines (27 loc) · 778 Bytes
/
symbol.hh
File metadata and controls
34 lines (27 loc) · 778 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
#ifndef SYMBOL_HH
#define SYMBOL_HH
#include <string>
#include <vector>
#include <memory>
// Structure that represent one case in the symbol table.
struct Symbol {
std::string index; // Terminal
std::string input; // Non-terminal
std::string result; // different token possibilities
Symbol(std::string _index, std::string _input, std::string _result) {
index = _index;
input = _input;
result = _result;
};
};
// Class that store all cases of the symbol table and give access to it.
class TableSymbol {
std::vector<std::unique_ptr<Symbol>> table;
public:
TableSymbol();
~TableSymbol() = default;
std::string find(std::string index, std::string input); // Function used to get the possible tokens
private:
void init();
};
#endif //SYMBOL_HH