Skip to main content

DialectRegistry

Struct DialectRegistry 

Source
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

Source

pub fn new() -> Self

Create a new registry containing only the base dialect.

Source

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.

Source

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.

Source

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.

Source

pub fn len(&self) -> usize

The number of installed dialects (including the base dialect).

Source

pub fn is_empty(&self) -> bool

Always false — the registry always contains at least the base dialect.

Source

pub fn is_well_formed(&self) -> bool

Well-formedness check: base dialect is at index 0 (REQ-032).

Source

pub fn get(&self, index: usize) -> Option<&Dialect>

Get a dialect by index.

Source

pub fn find_by_name(&self, name: &str) -> Option<&Dialect>

Get a dialect by name.

Source

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.

Source

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.

Source

pub fn iter(&self) -> Iter<'_, Dialect> ⓘ

Iterate over all installed dialects in order.

Source

pub fn as_slice(&self) -> &[Dialect]

Return a slice of all installed dialects.

Trait Implementations§

Source§

impl Clone for DialectRegistry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DialectRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for DialectRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for DialectRegistry

Source§

impl<'a> IntoIterator for &'a DialectRegistry

Source§

type Item = &'a Dialect

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, Dialect>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl PartialEq for DialectRegistry

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for DialectRegistry

Auto Trait Implementations§

§

impl Forget for DialectRegistry

§

impl Freeze for DialectRegistry

§

impl Move for DialectRegistry

§

impl RefUnwindSafe for DialectRegistry

§

impl Send for DialectRegistry
where RawVecInner: Send, NodeRef<Owned, String, SExpr, LeafOrInternal>: Send, BoxRaw<(String, SExpr)>: Send, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Send, BoxRaw<(String, SetValZST)>: Send, NodeRef<Owned, String, StepDecl, LeafOrInternal>: Send, BoxRaw<(String, StepDecl)>: Send, Arc<Node>: Send, NodeRef<Owned, String, BTreeSet<String>, LeafOrInternal>: Send, BoxRaw<(String, BTreeSet<String>)>: Send, BoxRaw<Definition>: Send, BoxRaw<Lift>: Send, BoxRaw<CounterRule>: Send, BoxRaw<Value>: Send,

§

impl Sync for DialectRegistry
where RawVecInner: Sync, NodeRef<Owned, String, SExpr, LeafOrInternal>: Sync, BoxRaw<(String, SExpr)>: Sync, NodeRef<Owned, String, SetValZST, LeafOrInternal>: Sync, BoxRaw<(String, SetValZST)>: Sync, NodeRef<Owned, String, StepDecl, LeafOrInternal>: Sync, BoxRaw<(String, StepDecl)>: Sync, Arc<Node>: Sync, NodeRef<Owned, String, BTreeSet<String>, LeafOrInternal>: Sync, BoxRaw<(String, BTreeSet<String>)>: Sync, BoxRaw<Definition>: Sync, BoxRaw<Lift>: Sync, BoxRaw<CounterRule>: Sync, BoxRaw<Value>: Sync,

§

impl Unpin for DialectRegistry
where *const u8 is !null: Unpin, *const LeafNode<String, SExpr> is !null: Unpin, Box<(String, SExpr)>: Unpin, *const LeafNode<String, SetValZST> is !null: Unpin, Box<(String, SetValZST)>: Unpin, *const LeafNode<String, StepDecl> is !null: Unpin, Box<(String, StepDecl)>: Unpin, Arc<Node>: Unpin, *const LeafNode<String, BTreeSet<String>> is !null: Unpin, Box<(String, BTreeSet<String>)>: Unpin, Box<Definition>: Unpin, Box<Lift>: Unpin, Box<CounterRule>: Unpin, Box<Value>: Unpin,

§

impl UnsafeUnpin for DialectRegistry

§

impl UnwindSafe for DialectRegistry

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.