[−][src]Struct lalrpop_lambda::wasm::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]
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
unsafe fn ref_from_abi(js: Self::Abi, _extra: &mut dyn Stack) -> Self::Anchor
[src]
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
fn into_abi(self, _extra: &mut dyn Stack) -> u32
[src]
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
unsafe fn from_abi(js: u32, _extra: &mut dyn Stack) -> Self
[src]
impl OptionFromWasmAbi for Exp
[src]
impl OptionIntoWasmAbi for Exp
[src]
impl RefMutFromWasmAbi for Exp
[src]
Auto Trait Implementations
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, 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> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> ReturnWasmAbi for T where
T: IntoWasmAbi,
[src]
T: IntoWasmAbi,
type Abi = <T as IntoWasmAbi>::Abi
Same as IntoWasmAbi::Abi