-
Notifications
You must be signed in to change notification settings - Fork 59
/
main.cpp
38 lines (31 loc) · 933 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
#include <iostream>
#include <fstream>
#include "ASTNodes.h"
#include "CodeGen.h"
#include "ObjGen.h"
extern shared_ptr<NBlock> programBlock;
extern int yyparse();
// extern void yyparse_init(const char* filename);
// extern void yyparse_cleanup();
//
//void createCoreFunctions(CodeGenContext& context);
int main(int argc, char **argv) {
yyparse();
// std::cout << programBlock << std::endl;
programBlock->print("--");
auto root = programBlock->jsonGen();
// cout << root;
// cout << root << endl;
CodeGenContext context;
// createCoreFunctions(context);
context.generateCode(*programBlock);
ObjGen(context);
string jsonFile = "visualization/A_tree.json";
std::ofstream astJson(jsonFile);
if( astJson.is_open() ){
astJson << root;
astJson.close();
cout << "json write to " << jsonFile << endl;
}
return 0;
}