-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
66 lines (64 loc) · 1.73 KB
/
main.cpp
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
56
57
58
59
60
61
62
63
64
65
66
#include "/Users/antony/CLionProjects/mlang_interpreter/scanner.h"
#include "/Users/antony/CLionProjects/mlang_interpreter/parser.h"
#include "/Users/antony/CLionProjects/mlang_interpreter/executer.h"
// test Scanner
//int main() {
// Scanner scan("/Users/antony/CLionProjects/prak4/model_lang/model_program.txt");
// Lex lex;
// do {
// try {
// lex = scan.get_lex();
// } catch (char c) {
// if (c != EOF) {
// cout << "Caught an exception -- " << c << endl;
// } else {
// cout << "Caught an exception -- EOF" << endl;
// }
// return 0;
// }
// cout << lex << endl;
// } while (lex.get_type() != LEX_FIN);
// return 0;
//}
//// test Parser
//int main() {
// try {
// Parser P("/Users/antony/CLionProjects/mlang_interpreter/model_program.txt");
// P.analyze();
//// int a = 1;
//// cout << (double &) a << endl;
// return 0;
// }
// catch (char c) {
// cout << "unexpected symbol " << c << endl;
// return 1;
// }
// catch (Lex l) {
// cout << "unexpected lexeme" << l << endl;
// return 1;
// }
// catch (const char* source) {
// cout << source << endl;
// return 1;
// }
//}
// test Executor
int main() {
try {
Interpretator I("/Users/antony/CLionProjects/mlang_interpreter/model_program.txt");
I.interpretation();
return 0;
}
catch (char c) {
cout << "unexpected symbol " << c << endl;
return 1;
}
catch (Lex& l) {
cout << "unexpected lexeme" << l << endl;
return 1;
}
catch (const char *source) {
cout << source << endl;
return 1;
}
}