-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.cpp
26 lines (25 loc) · 907 Bytes
/
test.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
#include "./include/lexer.h"
#include "include/parser.h"
#include <cstdlib>
#include <fstream>
#include "include/ir_gen/module.h"
int main()
{
std::filebuf foutbuf, errorbuf, llvmbuf;
errorbuf.open("error.txt", std::ios::out);
foutbuf.open("output.txt", std::ios::out);
llvmbuf.open("llvm_ir.txt", std::ios::out);
std::ostream iout(&llvmbuf);
std::ostream fout(&foutbuf);
std::ostream eout(&errorbuf);
// std::ostream& fout = (std::cout);
ExceptionController* exceptionController = new ExceptionController(&eout);
Lexer* lexer = new Lexer(&fout, exceptionController, "testfile.txt");
// TableManager* tableManager = new TableManager();
Module* ir_module = new Module(&iout);
Parser parser = *new Parser(lexer, &fout, ir_module, exceptionController);
parser.CompUnit();
if (exceptionController->correct)
ir_module->print();
return 0;
}