Skip to content
beskid The Beskid Book

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

15.5 Pipeline phases

mod.collect through mod.rewrite in the host pipeline and beskid_pipeline phase IDs.

Pipeline phases

Mods insert between parse and lowering: after you have syntax, before you pretend Cranelift will save you.

From Compiler Mod SDK: pipeline interaction:

flowchart TB
  accTitle: Compiler Mod phase order
  accDescr: Mod collection and generation run first, then semantic rules, then mod analysis and rewriting, before lowering.
  collect[mod.collect: Collector scopes targets]
  generate[mod.generate: merge + reparse loops]
  semantic[Semantic rules and composition.resolve]
  analyze[mod.analyze: diagnostics on merged program]
  rewrite[mod.rewrite: apply fixes]
  lower[lower]
  collect --> generate --> semantic --> analyze --> rewrite --> lower

Text equivalent: The host collects Mod contracts and merges generated source. Semantic processing and composition resolution run next. The host then analyzes the merged program, applies approved rewrites, and lowering follows.

PhaseHost concern
discovery / loadFind AOT artifacts, build schedule
collectNarrow work per mod instance
generate / merge / reparseTyped AST contributions
analyzeRun analyzers on merged snapshot
rewriteApply rewriter results

Map: Mod host bridge flow, Crate-to-spec anchors.

Rust host composition shares phase IDs across CLI, analysis, and codegen services. Avoid ad-hoc logging strings in random crates (Pipeline composition, Stage ordering).

Dependency injection inside the Rust host is compile-time and read-only to mods/SDK. Do not expect to register services from Beskid mod code.