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.
Author-facing order
Section titled “Author-facing order”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.
Host modules (beskid_analysis::mod_host)
Section titled “Host modules (beskid_analysis::mod_host)”| Phase | Host concern |
|---|---|
discovery / load | Find AOT artifacts, build schedule |
collect | Narrow work per mod instance |
generate / merge / reparse | Typed AST contributions |
analyze | Run analyzers on merged snapshot |
rewrite | Apply rewriter results |
Map: Mod host bridge flow, Crate-to-spec anchors.
beskid_pipeline
Section titled “beskid_pipeline”Rust host composition shares phase IDs across CLI, analysis, and codegen services. Avoid ad-hoc logging strings in random crates (Pipeline composition, Stage ordering).
IoC note
Section titled “IoC note”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.
Where to go next
Section titled “Where to go next”- Ship a mod: keep Compiler Mod SDK open beside your editor.
- Debug pipeline: 14. From source to something that runs
- Change law: 12. The normative bible