-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
41 lines (31 loc) · 963 Bytes
/
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
#include "lexer/lexer.hpp"
#include "parser/parser.hpp"
#include "type_checker.hpp"
#include "interpreter.hpp"
#include <fstream>
int main(int argc, const char* argv[]) {
std::ifstream file;
std::string path = argv[1];
file.open(path, std::ios::binary);
koala::lexer lexer(file, path);
koala::parser parser(lexer);
koala::type_checker type_checker(parser);
koala::interpreter interpreter(parser);
lexer.lex();
parser.parse();
for (koala::statement* s : *parser.get_ast()) {
if (s)
printf("%s\n", s->print(0).c_str());
}
type_checker.check();
interpreter.init();
koala::interpreter::value* return_value = interpreter.call_function(
"main", {}
// {
// interpreter.make_value(100),
// interpreter.make_value("Hello, world!")
// }
);
// if (return_value)
// printf("return_value=%s\n", return_value->str().c_str());
}