Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

AST and HIR shape contract - Design model

Platform spec article

AST and HIR shape contract - Design model

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

This article documents design model for ast and hir shape contract in the reference compiler.

For newcomers, this page explains where the contract shows up in day-to-day compiler work and which code paths are most useful first reads.

  • compiler/crates/beskid_analysis/src/syntax/items/ exposes AST-like syntax node shapes.
  • compiler/crates/beskid_analysis/src/resolve/items.rs maps parsed items into resolved structures.
  • compiler/crates/beskid_analysis/src/analysis/ consumes those shapes for semantic passes.

extend type lowers to HIR member metadata attached to the extended type symbol. Generated extensions from mod contracts follow the same lowering path as hand-authored extensions. HIR must not partially encode unmerged generator contributions.

  • Prefer tracing from CLI/test entry points into analysis/codegen crates before changing internals.
  • Treat diagnostics and tests as part of the contract, not optional implementation details.
  • If behavior changes, update this article and add/adjust tests in compiler/crates/beskid_tests or compiler/crates/beskid_e2e_tests.