-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
55 lines (53 loc) · 1.68 KB
/
main.cpp
File metadata and controls
55 lines (53 loc) · 1.68 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
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <iostream>
#include "scanner.hpp"
#include "parser.hpp"
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include "interpretator.hpp"
using namespace std;
extern tabl_ident TID;
extern map<string, vector<Ident>>map_struct;
// extern vector<Ident*>labels;
extern tabl_ident const_str;
int main(int argc, char** argv){
Interpretator inter(argv[argc - 1]);
inter.interpretation();
const int N = 15;
cout << endl << "Table of identefiers:" << endl;
cout << setw(3) << "ID" <<
setw(N) << "Name" <<
setw(N) << "Type" <<
setw(N) << "Is declare" <<
setw(N) << "Is assign" <<
setw(N) << "Value" <<
setw(N) << "Info" << endl;
for (int i = 0; i < TID.getTop(); i++){
cout << setw(3) << i <<
setw(N) << TID[i].get_name() <<
setw(N) << TID[i].get_type() <<
setw(N) << TID[i].get_declare() <<
setw(N) << TID[i].get_assign() <<
setw(N) << TID[i].get_value() <<
setw(N) << TID[i].get_info();
if (TID[i].get_info() == "label"){
for (auto& j: TID[i].label_info()) cout << " " << j;
}
cout << endl;
}
cout << endl << "Struct dict:" << endl;
if (map_struct.size() == 0) cout << "None" << endl;
for (auto &i: map_struct){
cout << i.first << ": ";
for (auto &j: i.second){
cout << j.get_name() << " ";
}
cout << endl;
}
cout << endl << "Const strings: " << endl;
for (int i = 0; i < const_str.getTop(); i++){
cout << i << ": \"" << const_str[i].get_name() << "\"" << endl;
}
return 0;
}