Struct Repl
pub struct Repl { /* private fields */ }Expand description
The Vernacular REPL.
Maintains a kernel context and executes commands against it.
Implementations§
§impl Repl
impl Repl
pub fn execute(&mut self, input: &str) -> Result<String, InterfaceError>
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).
pub fn execute_batch(
&mut self,
inputs: &[String],
) -> Vec<Result<String, InterfaceError>>
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 (Tree↔Forest)
is registered as one mutual block; an acyclic reference (Leafy → Bare) 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.
pub fn context(&self) -> &Context
pub fn context(&self) -> &Context
Get a reference to the underlying context.
pub fn context_mut(&mut self) -> &mut Context
pub fn context_mut(&mut self) -> &mut Context
Get a mutable reference to the underlying context.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.