-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtaxicality_main.cpp
More file actions
42 lines (35 loc) · 894 Bytes
/
taxicality_main.cpp
File metadata and controls
42 lines (35 loc) · 894 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
39
40
41
42
#include "taxicality_config.hpp"
#include "Print_Visitor.hpp"
#include "Symtab_Pass_Visitor.hpp"
#include "Executor.hpp"
#include "interpreter.hpp"
#include <queue>
#include <fstream>
using std::queue;
int main(int argc, char** argv)
{
string print_symbol = argv[1];
string errors = parse_and_check(argv + 2);
if(errors!="")
{
cout << errors << endl;
return 1;
}
errors = execute();
if(errors!="")
{
cout << errors << endl;
return 2;
}
if(print_symbol=="ALL")
for(auto& i : symtab)
cout << i.first << ": " << get_value(i.second) << endl;
else if(symtab.count(print_symbol))
cout << get_value(symtab[print_symbol]) << endl;
else
{
cout << "Error: no such symbol in symbol table." << endl;
return 4;
}
return 0;
}