MCPcopy Create free account
hub / github.com/SaptakBhoumik/Peregrine / Codegen

Method Codegen

Peregrine/codegen/cpp/codegen.cpp:52–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50namespace cpp {
51
52Codegen::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
67std::string Codegen::write(std::string_view code) {

Callers

nothing calls this directly

Calls 2

global_nameFunction · 0.85
acceptMethod · 0.80

Tested by

no test coverage detected