Skip to main content

Repl

Struct Repl 

Source
pub struct Repl { /* private fields */ }
Expand description

The Vernacular REPL.

Maintains a kernel context and executes commands against it.

Implementations§

Source§

impl Repl

Source

pub fn new() -> Self

Create a new REPL with the standard library loaded.

Source

pub fn execute(&mut self, input: &str) -> Result<String, InterfaceError>

Execute a command string.

Returns the output string (for Check/Eval) or empty string (for Definition/Inductive).

Source

pub fn execute_batch( &mut self, inputs: &[String], ) -> Vec<Result<String, InterfaceError>>

Execute a batch of Vernacular commands, recovering mutual-inductive grouping.

execute registers each Inductive independently, so a forward reference between two separately-declared inductives — Tree whose Node constructor mentions Forest, declared next — fails: Forest is not yet in scope when Tree’s constructor is universe-checked. True mutual inductives must be registered together, through the trusted Context::add_mutual_inductives, which runs whole-block positivity and a header-first universe check.

This entry point recovers that grouping from a flat statement sequence: a maximal run of consecutive Inductive commands is split into strongly-connected components of the “a constructor mentions sibling b” graph. A genuine cycle (TreeForest) is registered as one mutual block; an acyclic reference (LeafyBare) becomes two singletons registered dependency-first (Bare, then Leafy) through the ordinary single-inductive path. Every non-inductive command — and every inductive with no forward reference — runs exactly as execute would, in source order, so a batch without forward references is byte-identical to running the statements singly.

Source

pub fn context(&self) -> &Context

Get a reference to the underlying context.

Source

pub fn context_mut(&mut self) -> &mut Context

Get a mutable reference to the underlying context.

Trait Implementations§

Source§

impl Default for Repl

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl Freeze for Repl

§

impl RefUnwindSafe for Repl

§

impl Send for Repl

§

impl Sync for Repl

§

impl Unpin for Repl

§

impl UnsafeUnpin for Repl

§

impl UnwindSafe for Repl

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.