HIR — High-level IR

The HIR pass converts expanded syntax trees into a typed intermediate representation. It resolves bindings, computes captures, and infers signal profiles.

Key types

location, and inferred Signal

lambda, let, if, begin, etc.

primitive)

What analysis does

1. Binding resolution — names → Binding references with scope depth and index 2. Capture analysis — which free variables a closure captures, whether they are mutable 3. Signal inference — interprocedural: traces call chains to determine whether a function can yield, error, or is pure 4. Tail position marking — identifies calls in tail position for TCO 5. Special form analysisif, let, begin, block, match, defmacro, etc. each have dedicated handlers

Signal inference

Three signal categories:

(e.g., (map f xs) — signals depend on f)

silence constrains a parameter to be pure at compile time. The inference propagates through call chains interprocedurally.

Files

src/hir/expr.rs           Hir and HirKind definitions
src/hir/analyze/mod.rs    Main analysis entry point
src/hir/analyze/binding.rs  Binding resolution
src/hir/analyze/forms.rs  Special form handlers
src/hir/analyze/special.rs  More special forms

See also