-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
40 lines (36 loc) · 961 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
namespace boost {
void throw_exception( std::exception const & e ) {
llvm::errs() << "user provided boost::throw_exception() called.\naborting...\n";
abort();
}
}
int main() {
yydebug = 0;
int res = yyparse();
switch (res) {
case(0):
llvm::outs() << "yyparse() successfully finished.\n";
break;
case(1):
llvm::outs() << "yyparse() failed: invalid input.\n";
break;
case(2):
llvm::outs() << "yyparse() failed: memory exhaustion.\n";
break;
default:
llvm::outs() << "wrong return value from yyparse()\n";
}
//pre_dump();
std::error_code ec;
raw_fd_ostream outf("test.py", ec, llvm::sys::fs::OpenFlags::F_None);
//raw_fd_ostream outf(1, false);
codegen(&outf);
}
StringMap<Value*> variableTable;
StringMap<Type*> namedTypes;
StringMap<JsonTemplate*> templateTable;
list<string> stringTable;
Json * json_root;
list<Type*> typeTable;
#include "pre_dump.cpp"
#include "codegen.cpp"