-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
28 lines (24 loc) · 716 Bytes
/
main.cpp
File metadata and controls
28 lines (24 loc) · 716 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
#include <Interpreter.h>
#include <iostream>
#include "Parser.h"
#include "Lexer.h"
int main() {
try {
while(true) {
std::cout << "alpha>";
std::string input;
std::getline(std::cin, input);
if(input.empty()) continue;
if(input == "exit") break;
Lexer lexer(input);
Parser parser(lexer);
Interpreter interpreter(parser);
std::string result = interpreter.interpret();
std::cout << result << std::endl;
}
std::cout << "alpha exited with exit code 0";
return 0;
} catch (std::exception e) {
std::cerr << "Error: " << e.what() << std::endl;
}
}