-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
38 lines (28 loc) · 755 Bytes
/
main.cpp
File metadata and controls
38 lines (28 loc) · 755 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
37
38
#include "analyzers/LexemAnalyzer.h"
#include "analyzers/SyntacticAnalyzer.h"
#include "analyzers/Executor.h"
#include <iostream>
#include <fstream>
#include <vector>
int main(int argc, char** argv) {
try {
std::ifstream f(argv[1]);
LexemAnalyzer analyzer(f);
if (!analyzer.analyze())
return -1;
std::vector<Lexem> lexems = analyzer.getLexems();
analyzer.printLexems();
analyzer.printTable();
SyntacticAnalyzer a(analyzer.getLexems(), analyzer.getTable(), analyzer.getString());
if (!a.analyze())
return -1;
std::cout << "Great!" << std::endl;
a.printTable();
a.printRPN();
Executor executor(a.getRPN(), a.getTableIdent());
executor.execute();
}
catch (std::string msg){
std::cout << msg << std::endl;
}
}