51 "import \"math.aw\";\n"
52 "let answer = add(40, 2);\n"});
64 std::cerr << label <<
" failed\n";
66 if (
const auto * messages = driver.
find_artifact(
"driver.messages");
68 std::cerr << messages->text;
73 print_first_lines(
const std::string & text,
74 const size_t max_lines)
76 std::istringstream input(text);
79 while (printed < max_lines
and std::getline(input, line))
81 std::cout << line <<
'\n';
89 const auto inputs = build_inputs();
92 if (not run_driver.
execute_sources(inputs, Compiler_Driver_Action::Run))
93 return report_failure(run_driver,
"run") ? 0 : 1;
95 std::cout <<
"=== imports.order ===\n";
97 std::cout <<
"=== run.result ===\n";
99 std::cout <<
"=== run.globals ===\n";
104 Compiler_Driver_Action::Emit_Bytecode))
105 return report_failure(bytecode_driver,
"emit-bytecode") ? 0 : 1;
107 std::cout <<
"\n=== bytecode ===\n";
115 if (not c_driver.
execute_sources(inputs, Compiler_Driver_Action::Emit_C))
116 return report_failure(c_driver,
"emit-c") ? 0 : 1;
118 std::cout <<
"\n=== emit-c (first 24 lines) ===\n";
End-to-end multi-file driver for the compiler-support pipeline.
Reusable orchestration object for compiler pipeline experiments.
std::string diagnostics_text() const
Renders diagnostics from the last run as plain text.
const Compiler_Driver_Run_Output & run_output() const noexcept
Returns the run summary from the last run action.
const Compiler_C_Backend_Emission & c_emission() const noexcept
Returns the C emission payload from the last emit-c action.
const Compiler_Driver_Artifact * find_artifact(std::string_view label) const noexcept
Finds one artifact by label.
bool execute_sources(const DynArray< Compiler_Driver_Source > &inputs, const Compiler_Driver_Action action=Compiler_Driver_Action::Run)
Runs the pipeline over in-memory sources.
T & append()
Allocate a new entry to the end of array.
Main namespace for Aleph-w library functions.
and
Check uniqueness with explicit hash + equality functors.
std::string source
Final generated C translation unit.
bool emit_main
Whether to emit a standalone main() when the IR has a top-level body.
std::string module_name
Prefix used to derive stable C identifiers.
std::string text
Deterministic plain-text artifact payload.
Immutable configuration shared by all runs of one driver object.
Compiler_C_Backend_Options c_backend_options
Backend-C emission options used by emit-c.
std::string globals_text
Stable dump of the final globals environment.