blob: 9f85093ba9fb85da869ff9d8e8a1583a35242205 (
plain)
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 <iostream>
#include "ast.h"
#include "environment.h"
#include "error.h"
#include "prelude.h"
using namespace std;
int main(){
Environment env;
env.load(prelude);
string line;
cout<<"> ";
while(getline(cin,line)){
try {
AST parsed(line);
cerr<<"Parsed: "<<parsed<<endl;
const AST &res=env.run(parsed);
cout<<res<<endl;
} catch(runtime_error e){
cerr<<"\x1B[1mError: "<<e.what()<<"\x1B[0m"<<endl;
}
cout<<"> ";
}
return 0;
}
|