[−][src]Struct lambda_calc::ast::Ast
The abstract syntax tree constructed from the lambda expression.
Implementations
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, parser: &Parser) -> Option<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))", None) .unwrap() .unwrap(); let non_redex = redex.beta_reduce_print(&parser); assert_eq!(non_redex, Some(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, parser: &Parser) -> Option<Ast>
[src]
Identical to beta_reduce_print() but doesn't print anything.
Trait Implementations
impl Clone for Ast
[src]
impl Debug for Ast
[src]
impl Display for Ast
[src]
If a program will read the output, use the alternate formatter, which does not use ANSI color escapes or non-ASCII unicode characters.
impl Eq for Ast
[src]
impl PartialEq<Ast> for Ast
[src]
impl StructuralEq for Ast
[src]
impl StructuralPartialEq for Ast
[src]
Auto Trait Implementations
impl RefUnwindSafe for Ast
impl Send for Ast
impl Sync for Ast
impl Unpin for Ast
impl UnwindSafe for Ast
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
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> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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>,