Struct fetish_lib::interpreter_state::InterpreterState [−][src]
pub struct InterpreterState<'a> { pub application_tables: HashMap<TypeId, ApplicationTable<'a>>, pub type_spaces: HashMap<TypeId, TypeSpace>, pub ctxt: &'a Context, }
Expand description
Represents the state of a simple interpreter for the combinatorial language
defined through the referenced Context
, with the given TypeId
-indexed
TypeSpace
s and ApplicationTable
s memoizing all known non-primitive terms
and results of term evaluations, respectively.
Fields
application_tables: HashMap<TypeId, ApplicationTable<'a>>
type_spaces: HashMap<TypeId, TypeSpace>
ctxt: &'a Context
Implementations
impl<'a> InterpreterState<'a>
[src]
impl<'a> InterpreterState<'a>
[src]pub fn get_context(&self) -> &Context
[src]
pub fn get_context(&self) -> &Context
[src]Gets the Context
that this InterpreterState
operates within.
pub fn store_term(
&mut self,
type_id: TypeId,
term: PartiallyAppliedTerm
) -> NonPrimitiveTermPointer
[src]
pub fn store_term(
&mut self,
type_id: TypeId,
term: PartiallyAppliedTerm
) -> NonPrimitiveTermPointer
[src]Stores the given PartiallyAppliedTerm
in the TypeSpace
for the
given TypeId
, if it wasn’t already present. Returns a
NonPrimitiveTermPointer
referencing where it was stored
in this InterpreterState
.
pub fn get(&self, term_ptr: TermPointer) -> PartiallyAppliedTerm
[src]
pub fn get(&self, term_ptr: TermPointer) -> PartiallyAppliedTerm
[src]Given a TermPointer
, yields the PartiallyAppliedTerm
which
is stored at that location within this InterpreterState
(or,
in the case of a primitive, within the containing Context
)
pub fn get_nonprimitive(
&self,
term_ptr: NonPrimitiveTermPointer
) -> &PartiallyAppliedTerm
[src]
pub fn get_nonprimitive(
&self,
term_ptr: NonPrimitiveTermPointer
) -> &PartiallyAppliedTerm
[src]Given a NonPrimitiveTermPointer
, yields the PartiallyAppliedTerm
which is stored at that location within this InterpreterState
.
pub fn get_app_results_with_arg(
&self,
arg: &TermReference
) -> Vec<TermApplicationResult>
[src]
pub fn get_app_results_with_arg(
&self,
arg: &TermReference
) -> Vec<TermApplicationResult>
[src]Gets all currently-known TermApplicationResult
s which use the given TermReference
argument.
pub fn get_app_results_with_func(
&self,
func: TermPointer
) -> Vec<TermApplicationResult>
[src]
pub fn get_app_results_with_func(
&self,
func: TermPointer
) -> Vec<TermApplicationResult>
[src]Gets all currently-known TermApplicationResult
s which involve the function
that the given TermPointer
points to.
pub fn get_app_results_with_result(
&self,
result_term: &TermReference
) -> Vec<TermApplicationResult>
[src]
pub fn get_app_results_with_result(
&self,
result_term: &TermReference
) -> Vec<TermApplicationResult>
[src]Gets all currently-known TermApplicationResult
s which had the given TermReference
result.
pub fn evaluate(
&mut self,
term_app: &TermApplication
) -> (TermReference, NewlyEvaluatedTerms)
[src]
pub fn evaluate(
&mut self,
term_app: &TermApplication
) -> (TermReference, NewlyEvaluatedTerms)
[src]Evaluates the given TermApplication
against this InterpreterState
, assuming
that the function pointed to in the TermApplication
is a primitive. Yields
a TermReference
to the result of the evaluation, and a list of NewlyEvaluatedTerms
for this InterpreterState
which resulted from evaluating the application.
pub fn ensure_every_type_has_a_term_on_init(&mut self) -> NewlyEvaluatedTerms
[src]
pub fn ensure_every_type_has_a_term_on_init(&mut self) -> NewlyEvaluatedTerms
[src]Convenience method that ensures that every type has at least one term, assuming
that this InterpreterState
was just-initialized. Returns NewlyEvaluatedTerms
for evaluations that were performed as a result of this operation.
pub fn new(ctxt: &'a Context) -> InterpreterState<'a>
[src]
pub fn new(ctxt: &'a Context) -> InterpreterState<'a>
[src]Constructs a fresh InterpreterState
operating within the given Context
.
Auto Trait Implementations
impl<'a> !RefUnwindSafe for InterpreterState<'a>
impl<'a> !Send for InterpreterState<'a>
impl<'a> !Sync for InterpreterState<'a>
impl<'a> Unpin for InterpreterState<'a>
impl<'a> !UnwindSafe for InterpreterState<'a>
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,