Skip to content

Compiler Internals

Cerune generates intermediate representations from source code and provides multiple execution and code-generation paths. This page summarizes their roles.

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

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.

See VM and Bytecode for VM instructions, the evaluation stack, function frames, and runtime failures.

See LIR and Native Code Generation for x86-64 lowering from MIR, ASM and object files, and target-specific calling conventions.

Run these commands from the Cerune repository root:

ターミナルウィンドウ
cerune emit-ir examples/hello.ceru
cerune emit-mir examples/hello.ceru
cerune run-vm examples/hello.ceru

The 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.