srdatalog.ir.core.dialect

Dialect base + Compiler registry.

A Dialect is a coherent set of types, ops, lowerings, rewrites, and a verifier. Dialects register with a Compiler at init time, which indexes them by name and exposes lookups for the pass driver.

The registry has no central enum of dialects — Property P1. Adding a new dialect = constructing a Dialect and calling register_dialect. No edits to this module.

See docs/ir_lowering_semantics.md, section 19.

Module Contents

Classes

Compiler

Holds the registered dialects.

Dialect

A registered dialect.

API

class srdatalog.ir.core.dialect.Compiler[source]

Holds the registered dialects.

The registry is the single source of truth for what dialects exist. Lookups happen by name; cross-dialect lowerings are resolved by matching the source op kind against each dialect’s lowerings list.

Initialization

property dialects: list[srdatalog.ir.core.dialect.Dialect]

All registered dialects, in registration order.

get_dialect(name: str) srdatalog.ir.core.dialect.Dialect[source]

Look up a registered dialect by name. Raises KeyError if missing.

register_dialect(d: srdatalog.ir.core.dialect.Dialect) None[source]

Register a dialect. Raises ValueError if d.name is already taken.

class srdatalog.ir.core.dialect.Dialect[source]

A registered dialect.

Fields: name — dialect identifier (e.g. “relation.sorted_array”). types — Type subclasses owned by this dialect. ops — Op subclasses owned by this dialect. lowerings — Lowering rules emitted out of this dialect. rewrites — Rewrite rules within this dialect. verifier — optional callable that validates the dialect’s IR shape; returns a list of VerificationError on failure.

lowerings: list[Any]

‘field(…)’

name: str

None

ops: list[type]

‘field(…)’

rewrites: list[Any]

‘field(…)’

types: list[type]

‘field(…)’

verifier: collections.abc.Callable[[Any], list[Any]] | None

None