pub struct DialectRegistry { /* private fields */ }Expand description
An ordered dialect collection with the base dialect always at index 0.
Mirrors the dialects : List Dialect field on Agent in Agent.lean,
extracted as a first-class type so it can be shared across agent and
pipeline contexts.
Invariant: dialects[0] == base_dialect().
Implementations§
Source§impl DialectRegistry
impl DialectRegistry
Sourcepub fn install(&mut self, d: Dialect) -> Result<(), DialectInstallError>
pub fn install(&mut self, d: Dialect) -> Result<(), DialectInstallError>
Install a dialect after verifying R1, R2, and R3 (REQ-034, REQ-060–062, REQ-070, REQ-080).
Returns an error if the dialect contains recursive performatives (R1),
has invalid resource bounds (R2), or redefines any of the 8 core
performatives (R3).
Matches Agent.installDialect in Agent.lean:38–39
with the R1 precondition from R1NoRecursion.lean:38–40,
the R2 precondition from R2ResourceBounds.lean:59–63,
and the R3 precondition from R3CorePreservation.lean:57.
Sourcepub fn resolve_ancestors<'a>(&'a self, d: &Dialect) -> Vec<&'a Dialect>
pub fn resolve_ancestors<'a>(&'a self, d: &Dialect) -> Vec<&'a Dialect>
Resolve d.extends to currently-installed ancestor dialects (REQ-206).
Names that do not match an installed dialect are silently skipped —
install-time R5 will only credit performatives from ancestors that the
registry actually knows about. The shorthand cbcl is aliased to the
canonical base dialect name cbcl-base since dialect literals
commonly write (extends cbcl) while the registry stores the base
under its full name.
Public so standalone tooling (e.g. cbcl verify) can match install-time
R5 semantics by feeding the result into crate::r5::verify_r5_with_ancestors.
Sourcepub fn install_with_signer(
&mut self,
d: Dialect,
signer: &dyn Signer,
) -> Result<R4Result, DialectInstallError>
pub fn install_with_signer( &mut self, d: Dialect, signer: &dyn Signer, ) -> Result<R4Result, DialectInstallError>
Install a dialect after verifying R1–R4 (REQ-034, REQ-060–062, REQ-070, REQ-080, REQ-090–091).
Like install but additionally checks R4 signature
integrity using the provided signer. Unsigned dialects are accepted
(the spec allows them with a warning); dialects with invalid
signatures are rejected with DialectInstallError::R4Violation.
Returns ((), R4Result) on success so callers can inspect whether the
dialect was signed or unsigned.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Always false — the registry always contains at least the base dialect.
Sourcepub fn is_well_formed(&self) -> bool
pub fn is_well_formed(&self) -> bool
Well-formedness check: base dialect is at index 0 (REQ-032).
Sourcepub fn find_by_name(&self, name: &str) -> Option<&Dialect>
pub fn find_by_name(&self, name: &str) -> Option<&Dialect>
Get a dialect by name.
Sourcepub fn base_definer_of(&self, name: &str) -> Option<&Dialect>
pub fn base_definer_of(&self, name: &str) -> Option<&Dialect>
The base dialect, if it defines name (REQ-033).
This is the only name-based lookup dispatch performs, and it is
confined to the base dialect because R3 guarantees the eight core
performatives have exactly one definer. A custom performative is never
looked up this way: it is resolved against the dialect its (lang …)
wrapper names, so which definition applies is fixed by the message
rather than by the installed set. That is what allows two dialects to
define the same performative name without conflict.
Matches Agent.baseDefinerOf in Agent.lean.
Sourcepub fn dialects_defining<'a>(
&'a self,
name: &'a str,
) -> impl Iterator<Item = &'a Dialect>
pub fn dialects_defining<'a>( &'a self, name: &'a str, ) -> impl Iterator<Item = &'a Dialect>
Every installed dialect defining name, in installation order.
Introspection only — capability queries, diagnostics, tooling. It is
deliberately not a dispatch path: several dialects may legitimately
define one name, and choosing between them is the (lang …) wrapper’s
job, not the registry’s.