-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymTable.h
More file actions
37 lines (28 loc) · 692 Bytes
/
SymTable.h
File metadata and controls
37 lines (28 loc) · 692 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
#pragma once
#include <iostream>
#include <map>
#include <string>
#include <fstream>
using namespace std;
class IdInfo {
public:
string type;
string name;
string kind;
IdInfo() {}
IdInfo(string type, string name, string kind)
: type(type), name(name), kind(kind) {}
};
class SymTable {
SymTable* pred;
map<string, IdInfo> ids;
string scopeName;
public:
SymTable(string name, SymTable* pred = NULL);
void addVar(string type, string name, string kind= "variabila");
bool existsId(string name);
IdInfo* findId(string name);
SymTable* getPred();
void print(ofstream& file);
~SymTable();
};