[][src]Struct lincoln_ir::PreCompileProgram

pub struct PreCompileProgram { /* fields omitted */ }

Methods

impl PreCompileProgram[src]

pub fn merge(&mut self, other: &PreCompileProgram) -> Result<(), Error>[src]

merge the instructions from another program

pub fn set_export(&mut self, label: impl StringLike) -> Result<(), Error>[src]

Set an entry to be exported

pub fn delete_ent(&mut self, label: impl StringLike) -> Result<(), Error>[src]

pub fn define_jmp(
    &mut self,
    label: impl StringLike,
    cont: impl StringLike,
    per: impl AsPermutation
) -> Result<EntryRef, Error>
[src]

Define a jmp instruction

A jmp instruction performs a specific permutation on its values. Then it will jump to another entry.

label: the name of the entry cont: the entry this instruction will jump to per: how to permutate the values

pub fn define_call(
    &mut self,
    label: impl StringLike,
    callee: impl StringLike,
    callcnt: u8,
    callcont: impl StringLike
) -> Result<EntryRef, Error>
[src]

Define a call instruction

A Call instruction will seperate the current context into two. One of them will be put in a closure and add to the other as a single value. Then it will jump to another entry.

label: the name of this entry callee: the entry this entry will jump to callcnt: how many values the current context will keep callcont: an entry to keep the rest of context

pub fn define_ret(
    &mut self,
    label: impl StringLike,
    variant: u8
) -> Result<EntryRef, Error>
[src]

Define a return instruction

The first value of the context will be picked up and treat as a closure. Its captured context released and merged into the current context. Then the closure's group entry reference will contain some variants. The specified variant will be used as the return target.

variant: which element of the group should be refer to

pub fn define_group(
    &mut self,
    label: impl StringLike,
    elements: &[impl StringLike]
) -> Result<EntryRef, Error>
[src]

Define a group of instructions

A group of entries contains zero of more variants. When called with a specific variants, it will be picked up and being used as the execution target.

label: the name of this group entry elements: the variant entries

pub fn externs(&self) -> Vec<(String, EntryRef)>[src]

Returns all defined external entries, including the name

pub fn compile(
    &self,
    externs: impl Iterator<Item = ExternEntry>
) -> Result<Program, Error>
[src]

Compile this program with a set of external functions

Trait Implementations

impl Default for PreCompileProgram[src]

impl Display for PreCompileProgram[src]

impl Debug for PreCompileProgram[src]

impl Serialize for PreCompileProgram[src]

impl<'de> Deserialize<'de> for PreCompileProgram[src]

impl<'a> Access<'a, PreCompileProgram> for EntryRef[src]

type Target = Result<&'a Entry, Error>

impl<'a> AccessMut<'a, PreCompileProgram> for EntryRef[src]

type Target = Result<&'a mut Entry, Error>

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

impl<T, U> TryInto 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> AnyDebugDisplay for T where
    T: Any + Debug + Display
[src]