Sibling articles under this feature previously restated requirements in inconsistent forms.
Stage ordering and lowering - Flow and algorithm
Platform spec article
Stage ordering and lowering - Flow and algorithm
Spec standingStandard
-
This feature hub owns normative MUST/SHOULD contract text for Stage ordering and lowering.
Context
Decision
This feature hub owns normative MUST/SHOULD contract text. Sibling articles must not redefine hub requirements and should link here for authority.
Consequences
Contract changes start on the hub or in linked ADRs, then propagate to articles and implementation anchors.
Verification anchors
site/website/src/content/docs/platform-spec/compiler/build-pipeline/stage-ordering/index.mdxarticle bundle under the same feature directory.
-
Platform-spec text supersedes informal crate comments for Stage ordering and lowering.
Context
Implementation crates accumulated informal notes that diverged from published contracts.
Decision
Normative platform-spec prose and ADRs under this feature supersede informal comments in implementation crates until explicitly migrated into spec text.
Consequences
Engineers file spec/ADR updates when behavior changes; crate comments are non-authoritative for conformance arguments.
Verification anchors
compiler/crates/beskid_analysis/
-
Pipeline ordering was fragmented across crates before `beskid_pipeline` phase ids.
Context
Reference compiler must emit stable
beskid_pipelinephase events from parse throughlower.readywithout reordering semantic gates relative to mod boundaries.Decision
Phase literals are defined in
compiler/crates/beskid_pipeline/src/phases.rsand asserted by conformance tests; CLI/LSP observers rely on the same ids.Consequences
Reordering phases requires an ADR and registry updates.
Verification anchors
compiler/crates/beskid_pipeline/compiler/crates/beskid_analysis/src/services.rs.
- Stage ordering and lowering - Contracts and edge cases Required ordering guarantees and behavior under parse or semantic failures.
- Stage ordering and lowering - Design model Pipeline stage model and artifact boundaries for the reference compiler.
- Stage ordering and lowering - Examples Newcomer-oriented examples of pipeline execution order and failure points.
- Stage ordering and lowering - FAQ and troubleshooting Troubleshooting guide for stage ordering assumptions in build and run commands.
- Stage ordering and lowering - Flow and algorithm Ordered lowering algorithm used by build and run command paths.
- Stage ordering and lowering - Verification and traceability Source and test anchors that verify lowering order and backend artifact handoff.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
End-to-end lowering spine
Section titled “End-to-end lowering spine”flowchart TB
r[1 Resolve CompilePlan]
a[2 program.assemble]
p[3 Parse units]
m{Mods in graph?}
mh[4 Mod collect generate reparse]
s[5 Semantic rules]
e{Error diagnostics?}
stop[Abort]
h[7 HIR resolve type-check]
l[8 lower to CodegenArtifact]
r --> a --> p --> m
m -->|yes| mh --> s
m -->|no| s
s --> e
e -->|yes| stop
e -->|no| h --> l
Ordered steps
Section titled “Ordered steps”- Resolve source path/text through services (manifest, workspace graph,
CompilePlan, optional materialized workspace). - Assemble program — Build
ProgramAssemblyfrom effective roots (program.assemble); discover and parse compilation units per Program assembly. - Parse entry (and indexed units) and produce syntax diagnostics.
- Mod host (when transitive
Moddependencies exist) — Load AOT artifacts, discover contracts, run collect → generate → analyze → rewrite under Mod host bridge policy, merge typed AST contributions, and re-parse as required (bounded bymaxGeneratorRounds). Skip when no mod dependencies apply. - Run builtin staged semantic rules when diagnostics are enabled (same diagnostic channel as mod diagnostics).
- Abort on error diagnostics.
- Transform to HIR, resolve symbols against
ModuleIndex, and type-check the entry unit. - Lower typed program to backend artifact for JIT/AOT.
The canonical lowering entrypoint remains beskid_codegen::services::lower_source (and _with_pipeline); mod orchestration must live in beskid_analysis services (or a dedicated host module re-exported there) so CLI, LSP, and codegen share one scheduling spine.