Crate gruel_rir

Crate gruel_rir 

Source
Expand description

Gruel Intermediate Representation (RIR) - Untyped IR.

RIR is the first IR in the Gruel compiler pipeline. It is generated from the AST and represents a lowered, linearized form of the program.

Key characteristics:

  • Untyped: type information is not yet resolved
  • Per-file: generated for each source file
  • Dense encoding: instructions stored in arrays, referenced by index

Inspired by Zig’s ZIR (Zig Intermediate Representation).

Structs§

AstGen
Generates RIR from an AST.
FunctionSpan
Stored representation of directive in the extra array. Layout: [name: u32, span_start: u32, span_len: u32, args_len: u32, args…] Variable size due to args. A span marking the boundaries of a function in the RIR.
Inst
A single RIR instruction.
InstRef
A reference to an instruction in the RIR.
Rir
The complete RIR for a source file.
RirCallArg
An argument in a function call.
RirDirective
A directive in the RIR (e.g., @allow(unused_variable))
RirFunctionView
A view into a function’s instructions within the RIR.
RirParam
A parameter in a function declaration.
RirPatternBinding
A binding in a data variant pattern.
RirPrinter
Printer for RIR that resolves symbols to their string values.

Enums§

InstData
Instruction data - the actual operation.
RirArgMode
Argument passing mode in RIR.
RirParamMode
Parameter passing mode in RIR.
RirPattern
A pattern in a match expression (RIR level - untyped).