[−][src]Struct lambda_calc::ast::Ast
The abstract syntax tree constructed from the lambda expression.
Methods
impl Ast[src]
pub fn new(expr: Expr) -> Ast[src]
pub fn expr_ref(&self) -> &Expr[src]
Get an un-mutable reference to the underlying expression.
pub fn beta_reduce_print(self) -> Ast[src]
Applies beta reductions until it's no longer possible, printing the result after each round of beta reduction.
Uses normal order reduction strategy (leftmost outermost redex first), otherwise certain reductions would loop infintely:
let mut parser = Parser::new(); let redex = parser .parse("(lambda x . a) ((lambda y . y y) (lambda y . y y))") .unwrap(); let non_redex = redex.beta_reduce_print(); assert_eq!(non_redex, Ast::new(Expr::Var{name: "a".to_string(), is_free: true}));
This function does not attempt to predict infinite loops.
pub fn beta_reduce_quiet(self) -> Ast[src]
Identical to beta_reduce_print() but doesn't print anything.
pub fn substitute_symbols_from(&mut self, symbol_table: &HashMap<String, Ast>)[src]
Trait Implementations
impl Clone for Ast[src]
impl Eq for Ast[src]
impl PartialEq<Ast> for Ast[src]
impl Display for Ast[src]
impl Debug for Ast[src]
Auto Trait Implementations
impl Send for Ast
impl Sync for Ast
impl Unpin for Ast
impl UnwindSafe for Ast
impl RefUnwindSafe for Ast
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> From<T> for T[src]
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,