srdatalog.ir.core

ir_core — dialect-agnostic IR framework.

Stage 1 of the multi-dialect IR refactor. The framework hosts dialects (data-structure, parallelism, target) without knowing what they are.

Spec: docs/ir_lowering_semantics.md. Discipline rules: docs/design_principles.md.

Public API:

Compiler — registry of dialects. Dialect — what every dialect provides. Op, Type — frozen+slots dataclass bases for IR ops/types. Lowering, Rewrite — pass kinds. PassDriver — runs registered passes. VerificationError — well-formedness violation. Strategy combinators — top_down, bottom_up, seq, choice, repeat, try_, all_, one, some, id_, fail. assert_never — exhaustiveness check for match defaults.

Design invariants:

P1 Open dialect registration. New dialects are purely additive. P2 Polymorphic relation references. MIR ops never name a dialect. P3 Dialect-local pass libraries. Each dialect ships its own passes.

D1 Op/Type subclasses are pure data. No methods. D2 IR is immutable (frozen dataclasses). D3 Dispatch via match statements over closed unions; never via virtual methods or isinstance chains. D4 Rewrites are pure functions. No mutable rewriter state.

Submodules

Package Contents

Functions

assert_never

Exhaustiveness check for match defaults.

Data

API

srdatalog.ir.core.__all__

[‘Compiler’, ‘Dialect’, ‘Lowering’, ‘Op’, ‘PassDriver’, ‘Rewrite’, ‘Strategy’, ‘Type’, ‘Verification…

srdatalog.ir.core.assert_never(value: object) NoReturn[source]

Exhaustiveness check for match defaults.

Use as the body of the catch-all branch in dispatchers over closed unions. Type checkers (mypy –strict, pyright) infer that the argument has type Never if all cases are covered, flagging unreachable-but-not-actually-handled cases at type-check time.