X-Git-Url: https://gitweb.ps.run/toc/blobdiff_plain/71a20a4f3d4e5f5278f7d004af710af89dfd7ebc..c4231c6faf4e1b4650b075c641b0bb8c053739e4:/src/main.cpp?ds=sidebyside diff --git a/src/main.cpp b/src/main.cpp index 4c78f5b..5b53b10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,14 +7,15 @@ #include "toc.h" #include "repr.h" #include "repr_get.h" -#include "check.h" +#include "generic.h" +//#include "check.h" using namespace antlr4; int main(int argc, const char * argv[]) { - std::ifstream ifs("test.toc"); + std::ifstream ifs("test/test.toc"); ANTLRInputStream input(ifs); @@ -31,20 +32,24 @@ int main(int argc, const char * argv[]) return 1; } - std::string s = tree->toStringTree(&parser) + "\n"; - + //std::string s = tree->toStringTree(&parser) + "\n"; //std::cout << "Parse Tree: " << s << std::endl; - Program prg = getProgram(prog); - - tocProgram(std::cout, prg); + Program prg = getProgram(prog, nullptr); + instantiateGenerics(prg); - if (!checkProgram(prg)) - std::cerr << "Error" << std::endl; + try + { + tocProgram(std::cout, prg); - //std::ofstream ofs("output.c"); - //tocProg(ofs, prg); - //ofs.close(); + std::ofstream ofs("output.c"); + tocProgram(ofs, prg); + ofs.close(); + } + catch (const char * e) + { + std::cerr << "Error: " << e << std::endl; + } return 0; } \ No newline at end of file