-
Notifications
You must be signed in to change notification settings - Fork 0
/
polizmain.cpp
49 lines (45 loc) · 1.06 KB
/
polizmain.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
#include <iostream>
#include <fstream>
#include "interpretlib.h"
int main(int argc,char *argv[]){
//vector<string> TS; // table of strings
if(argc>2){
cout << "Too much arguments!\n";
return -1;
}
else if(argc==1){
cout << "Too few arguments!\n";
return -1;
}
Parser par(argv[1]);
try{
par.interpretation();
cout << endl << endl << endl;
cout << "Syntax - OK\n";
cout << "Semantic - OK\n";
}
catch (char c){
cout << "Lex error - unexpected char: " << c << endl;
}
catch(error_msg er){
cout << "Syntax - not OK Line: "<< par.cur_string_number << " Error: " << er.message << er.error_lex << endl;
}
catch(const char* er){
cout << "Semantic - not OK Line: " << par.cur_string_number << " Error: " << er << endl;
}
catch(ex_error er){
cout << er.err;
}
par.print_vec(par.vc_lex);
cout << "Poliz:\n";
vector<Lexem>::const_iterator t = par.Poliz.begin();
if(t==par.Poliz.end()){
cout << "Empty Poliz\n";
}
while(t!=par.Poliz.end()){
cout << *t << " ";
t++;
}
cout << endl << endl << "Size: " << par.Poliz.size() << endl;
return 0;
}