| 50 | namespace cpp { |
| 51 | |
| 52 | Codegen::Codegen(std::string outputFilename, ast::AstNodePtr ast,std::string filename) { |
| 53 | m_filename=filename; |
| 54 | m_file.open(outputFilename); |
| 55 | m_file << "#include <setjmp.h>\n#include <cstdlib>\n#include <stdio.h>\n#include <stdint.h>\n#include <functional>\ntypedef enum{error________P____P____Error,error________P____P____AssertionError,error________P____P____ZeroDivisionError} error;\n"; |
| 56 | m_file<<"struct ____P____exception_handler{\n" |
| 57 | "jmp_buf* buf;\n" |
| 58 | "std::function<void(void)> handler;\n" |
| 59 | "error err;\n" |
| 60 | "};\n"; |
| 61 | m_global_name=global_name(filename); |
| 62 | ast->accept(*this); |
| 63 | m_file.close(); |
| 64 | } |
| 65 | |
| 66 | |
| 67 | std::string Codegen::write(std::string_view code) { |
nothing calls this directly
no test coverage detected