42#ifndef COMPILER_DRIVER_CONTRACTS_H
43#define COMPILER_DRIVER_CONTRACTS_H
84 return "emit-bytecode";
102 if (text ==
"parse-only" or text ==
"parse")
107 if (text ==
"sema-only" or text ==
"sema")
127 if (text ==
"emit-c" or text ==
"c")
132 if (text ==
"emit-bytecode" or text ==
"bytecode")
170namespace Compiler_Driver_Detail {
173 std::ostringstream
out;
174 out <<
prefix <<
'[' << index <<
"]:" << name;
179 const std::string &label,
182 artifacts.
append({label, std::move(text)});
185template <
typename Report>
191 for (
size_t i = 0; i <
report.errors.size(); ++i)
193 for (
size_t i = 0; i <
report.warnings.size(); ++i)
201 std::ostringstream
out;
202 out <<
"DriverMessages\n";
210 for (
size_t i = 0; i < errors.
size(); ++i)
211 out <<
" error: " << errors.
access(i) <<
'\n';
212 for (
size_t i = 0; i < warnings.
size(); ++i)
213 out <<
" warning: " << warnings.
access(i) <<
'\n';
219 std::ostringstream
out;
221 out <<
" Executed: " << (
output.executed ?
"true" :
"false") <<
'\n';
227 out <<
" Value: " <<
output.value_text <<
'\n';
230 out <<
" Error: " <<
output.result.error.code <<
" " <<
output.result.error.message <<
'\n';
231 if (
output.result.error.span.is_valid())
232 out <<
" Span: " <<
output.result.error.span.to_string() <<
'\n';
Reusable runtime and structured evaluator for HIR-based interpreters.
size_t size_t int32_t * out
size_t size() const noexcept
Return the current dimension of array.
T & access(const size_t i) const noexcept
Fast access without checking allocation and bound_min_clock checking.
T & append()
Allocate a new entry to the end of array.
bool is_empty() const noexcept
Return true if the array is empty.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
std::string render_messages(const DynArray< std::string > &errors, const DynArray< std::string > &warnings)
std::string artifact_label(const std::string &prefix, const size_t index, const std::string &name)
bool merge_report(const std::string &stage, const Report &report, DynArray< std::string > &errors, DynArray< std::string > &warnings)
std::string render_run_result(const Compiler_Driver_Run_Output &output)
void append_artifact(DynArray< Compiler_Driver_Artifact > &artifacts, const std::string &label, std::string text)
Main namespace for Aleph-w library functions.
Compiler_Driver_Action
High-level actions supported by compiler pipeline drivers.
@ Emit_C
Lower to IR and emit portable C.
@ IR
Stop after lowering to explicit IR.
@ Parse_Only
Stop after parsing and publish AST/frontend artifacts.
@ Run
Execute the lowered HIR module with Interpreter_Runtime.
@ Emit_Bytecode
Lower to IR and emit reusable bytecode.
@ Sema_Only
Stop after semantic analysis.
@ HIR
Stop after lowering to typed HIR.
and
Check uniqueness with explicit hash + equality functors.
static void prefix(Node *root, DynList< Node * > &acc)
const char * interpreter_control_flow_name(const Interpreter_Control_Flow_Kind kind) noexcept
Stable debug name for one control-flow outcome.
const char * compiler_driver_action_name(const Compiler_Driver_Action action) noexcept
Returns the canonical external spelling for one driver action.
bool compiler_parse_driver_action(std::string_view text, Compiler_Driver_Action &action) noexcept
Parses one canonical driver action spelling.
Stable text artifact produced during one pipeline run.
std::string text
Deterministic plain-text artifact payload.
std::string label
Logical artifact identifier such as hir or run.globals.
Structured output of a run action.
std::string value_text
Stable rendering of the produced value.
std::string globals_text
Stable dump of the final globals environment.
Interpreter_Execution_Result result
Raw runtime result.
bool executed
Whether the current driver action actually executed code.
bool ok() const noexcept
Returns whether execution succeeded or never ran.
One logical input source handled by a compiler frontend.
std::string text
Full source text.
std::string name
User-facing file name used in diagnostics and artifacts.
Result of evaluating one expression, statement, module, or call.
bool ok() const noexcept
Returns whether this result represents a runtime failure.
Lazy and scalable dynamic array implementation.