[][src]Trait zia::Call

pub trait Call<T> where
    Self: Definer<T> + ExecuteReduction<T> + SyntaxReader<T>,
    T: From<String> + From<Self::C> + From<Self::A> + RemoveDefinition + RemoveAsDefinitionOf + SetReduction + MakeReduceFrom + RemoveReduction + NoLongerReducesFrom + SetDefinition + SetAsDefinitionOf + FindWhatReducesToIt + GetReduction + GetDefinition + GetDefinitionOf + MaybeString,
    Self::S: Container + Pair<Self::S> + Clone + From<(String, Option<usize>)> + DisplayJoint + PartialEq<Self::S>, 
{ fn call(&mut self, ast: &Rc<Self::S>) -> Result<String, ZiaError> { ... }
fn call_pair(
        &mut self,
        left: &Rc<Self::S>,
        right: &Rc<Self::S>
    ) -> Result<String, ZiaError> { ... }
fn reduce_label_of(&self, ast: &Rc<Self::S>) -> Result<String, ZiaError> { ... }
fn try_expanding_then_call(
        &mut self,
        ast: &Rc<Self::S>
    ) -> Result<String, ZiaError> { ... }
fn try_reducing_then_call(
        &mut self,
        ast: &Rc<Self::S>
    ) -> Result<String, ZiaError> { ... }
fn call_as_righthand(
        &mut self,
        left: &Self::S,
        right: &Self::S
    ) -> Result<String, ZiaError> { ... }
fn match_righthand_pair(
        &mut self,
        left: &Self::S,
        rightleft: &Self::S,
        rightright: &Self::S
    ) -> Result<String, ZiaError> { ... } }

Calling a program expressed as a syntax tree to read or write contained concepts.

Provided methods

fn call(&mut self, ast: &Rc<Self::S>) -> Result<String, ZiaError>

If the associated concept of the syntax tree is a string concept that that associated string is returned. If not, the function tries to expand the syntax tree. If that's possible, call_pair is called with the lefthand and righthand syntax parts. If not try_expanding_then_call is called on the tree. If a program cannot be found this way, Err(ZiaError::NotAProgram) is returned.

fn call_pair(
    &mut self,
    left: &Rc<Self::S>,
    right: &Rc<Self::S>
) -> Result<String, ZiaError>

If the associated concept of the lefthand part of the syntax tree is LET then call_as_righthand is called with the left and right of the lefthand syntax. Tries to get the concept associated with the righthand part of the syntax. If the associated concept is -> then call is called with the reduction of the lefthand part of the syntax. Otherwise Err(ZiaError::NotAProgram) is returned.

fn reduce_label_of(&self, ast: &Rc<Self::S>) -> Result<String, ZiaError>

fn try_expanding_then_call(
    &mut self,
    ast: &Rc<Self::S>
) -> Result<String, ZiaError>

If the abstract syntax tree can be expanded, then call is called with this expansion. If not then an Err(ZiaError::NotAProgram) is returned

fn try_reducing_then_call(
    &mut self,
    ast: &Rc<Self::S>
) -> Result<String, ZiaError>

If the abstract syntax tree can be reduced, then call is called with this reduction. If not then an Err(ZiaError::NotAProgram) is returned

fn call_as_righthand(
    &mut self,
    left: &Self::S,
    right: &Self::S
) -> Result<String, ZiaError>

If the righthand part of the syntax can be expanded, then match_righthand_pair is called. If not, Err(ZiaError::NotAProgram) is returned.

fn match_righthand_pair(
    &mut self,
    left: &Self::S,
    rightleft: &Self::S,
    rightright: &Self::S
) -> Result<String, ZiaError>

If the lefthand of the righthand part of the syntax is -> then execute_reduction is called with the lefthand part and the righthand of the righthand part of the syntax. Similarly for :=, execute_definition is called. If the lefthand of the righthand part of the syntax is associated with a concept which isn't -> or := then if this concept reduces, match_righthand_pair is called with this reduced concept as an abstract syntax tree.

Loading content...

Implementors

impl<S, T> Call<T> for S where
    S: Definer<T> + ExecuteReduction<T> + SyntaxReader<T>,
    T: From<String> + From<Self::C> + From<Self::A> + RemoveDefinition + RemoveAsDefinitionOf + SetReduction + MakeReduceFrom + RemoveReduction + NoLongerReducesFrom + SetDefinition + SetAsDefinitionOf + FindWhatReducesToIt + GetReduction + GetDefinition + GetDefinitionOf + MaybeString,
    S::S: Container + Pair<S::S> + Clone + From<(String, Option<usize>)> + DisplayJoint + PartialEq<Self::S>, 
[src]

fn call(&mut self, ast: &Rc<Self::S>) -> Result<String, ZiaError>
[src]

fn call_pair(
    &mut self,
    left: &Rc<Self::S>,
    right: &Rc<Self::S>
) -> Result<String, ZiaError>
[src]

fn reduce_label_of(&self, ast: &Rc<Self::S>) -> Result<String, ZiaError>
[src]

fn try_expanding_then_call(
    &mut self,
    ast: &Rc<Self::S>
) -> Result<String, ZiaError>
[src]

fn try_reducing_then_call(
    &mut self,
    ast: &Rc<Self::S>
) -> Result<String, ZiaError>
[src]

fn call_as_righthand(
    &mut self,
    left: &Self::S,
    right: &Self::S
) -> Result<String, ZiaError>
[src]

fn match_righthand_pair(
    &mut self,
    left: &Self::S,
    rightleft: &Self::S,
    rightright: &Self::S
) -> Result<String, ZiaError>
[src]

Loading content...