[][src]Struct lalrpop_lambda::wasm::Exp

pub struct Exp(_);

A parsed λ-expression

This struct is a wrapper around an Expression to both allow exporting it to JS, and to contain functions functions we want to export for the Exp, for example Exp::to_string.

Methods

impl Exp[src]

pub fn new(v: JsValue) -> Result<Exp, JsValue>[src]

Parse and construct a new Expr

new lambda.Exp("(\\x.x x) y");
new lambda.Exp(2);
new lambda.Exp(false);
new lambda.Exp("*wtf");  // Throws exception.

pub fn applicative(&self, η: bool) -> Self[src]

pub fn call_by_value(&self) -> Self[src]

pub fn normal(&self, η: bool) -> Self[src]

pub fn call_by_name(&self) -> Self[src]

pub fn head_spine(&self, η: bool) -> Self[src]

pub fn to_string(&self) -> String[src]

See std::fmt::Display

let expr = new lambda.Exp("\\x.x x");
console.log(`${expr}`);

pub fn to_number(&self) -> usize[src]

See From<Expression> for u64

let two = new lambda.Exp("\\f.\\x.(f (f x))");
console.log(`${two.toNumber()}`);

pub fn to_bool(&self) -> bool[src]

See From<Expression> for bool

let t = new lambda.Exp("\\a.\\b.a");
console.log(`${t.toBool()}`);

Trait Implementations

impl From<Exp> for JsValue[src]

impl RefFromWasmAbi for Exp[src]

type Abi = u32

The wasm ABI type references to Self are recovered from.

type Anchor = Ref<'static, Exp>

The type that holds the reference to Self for the duration of the invocation of the function that has an &Self parameter. This is required to ensure that the lifetimes don't persist beyond one function call, and so that they remain anonymous. Read more

impl WasmDescribe for Exp[src]

impl IntoWasmAbi for Exp[src]

type Abi = u32

The wasm ABI type that this converts into when crossing the ABI boundary. Read more

impl FromWasmAbi for Exp[src]

type Abi = u32

The wasm ABI type that this converts from when coming back out from the ABI boundary. Read more

impl OptionFromWasmAbi for Exp[src]

impl OptionIntoWasmAbi for Exp[src]

impl RefMutFromWasmAbi for Exp[src]

type Abi = u32

Same as RefFromWasmAbi::Abi

type Anchor = RefMut<'static, Exp>

Same as RefFromWasmAbi::Anchor

Auto Trait Implementations

impl Send for Exp

impl Sync for Exp

Blanket Implementations

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

impl<T> From<T> for T[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> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> ReturnWasmAbi for T where
    T: IntoWasmAbi
[src]

type Abi = <T as IntoWasmAbi>::Abi

Same as IntoWasmAbi::Abi