Compiler Internals
Cerune generates intermediate representations from source code and provides multiple execution and code-generation paths. This page summarizes their roles.
Representations and execution paths
Section titled “Representations and execution paths”| Item | Description |
|---|---|
| Cerune IR | A shared intermediate representation with resolved types and references |
| MIR | An intermediate representation with explicit control flow and operations |
| SSA | A path that converts MIR into SSA form |
| VM | Execution through Cerune bytecode |
| Code generation | C, LLVM IR, QBE IR, WAT, native assembly, and object files |
Cerune IR (HIR)
Section titled “Cerune IR (HIR)”See Cerune IR (HIR) for resolved types and names, NodeId and source origins, direct IR execution, and MIR lowering.
See MIR for basic blocks, typed locals, branches, ownership operations, and direct MIR execution.
See SSA for scalar SSA construction, block arguments, joins, direct execution, and Native output.
VM and Bytecode
Section titled “VM and Bytecode”See VM and Bytecode for VM instructions, the evaluation stack, function frames, and runtime failures.
LIR and Native code generation
Section titled “LIR and Native code generation”See LIR and Native Code Generation for x86-64 lowering from MIR, ASM and object files, and target-specific calling conventions.
CLI examples
Section titled “CLI examples”Run these commands from the Cerune repository root:
cerune emit-ir examples/hello.cerucerune emit-mir examples/hello.cerucerune run-vm examples/hello.ceruThe observe command saves source information, intermediate representations, and source-to-output mappings from a single compilation. It requires an explicit --target and a new output directory specified by -o. See the CLI reference for details.