c-repl/src/main.cpp

23 lines
580 B
C++
Raw Normal View History

2023-10-20 17:06:27 +02:00
#include <iostream>
using namespace std;
2023-10-27 14:09:25 +02:00
#include "include/input.h"
2023-11-10 17:35:33 +01:00
#include "include/tokenize.h"
2023-10-27 17:53:58 +02:00
#include "include/parser.h"
2023-11-10 17:35:33 +01:00
#include "include/interpreter.h"
2023-10-20 17:06:27 +02:00
int main(int argc, char* argv[]) {
2023-11-10 17:35:33 +01:00
while (true) {
try {
string input = get_input();
vector<Token> tokens = tokenize(input);
Node ast = parse(tokens);
2023-11-10 19:04:24 +01:00
// _debug_print_tree(ast, 0, "");
2023-11-10 17:35:33 +01:00
EvalResult res = eval(ast);
cout << get<int>(res) << endl;
}
catch (...) { // temp
cout << "err" << endl;
}
}
2023-10-20 17:06:27 +02:00
}