-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterpriter.cpp
More file actions
32 lines (26 loc) · 878 Bytes
/
interpriter.cpp
File metadata and controls
32 lines (26 loc) · 878 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
//============================================================================
// Name : interpriter.cpp
// Author : atamas
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <iostream>
#include "Parser.h"
#include "Function.h"
#include "Evaluator.h"
using std::string;
using std::map;
using std::ifstream;
int main (int argc, char **argv){
ifstream inf(argv[1]);
map<string, int> varNamespace;
map<string, Function const *> funcNamespace;
Parser parser(inf);
vector<ASTNode const *> mainScope = parser.parse(funcNamespace);
Evaluator * evaluator = new Evaluator(varNamespace, funcNamespace);
for(unsigned int pos = 0; pos < mainScope.size(); ++pos){
mainScope[pos]->visit(evaluator);
}
}