[][src]Struct lambda_calc::ast::Ast

pub struct Ast { /* fields omitted */ }

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]

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]