[][src]Enum basic::mach::Op

pub enum Op {
    Literal(Val),
    Push(String),
    Pop(String),
    For(Address),
    If(Address),
    Jump(Address),
    Return,
    Clear,
    Cont,
    End,
    Input,
    List,
    Print,
    Stop,
    Neg,
    Exp,
    Mul,
    Div,
    DivInt,
    Mod,
    Add,
    Sub,
    Eq,
    NotEq,
    Lt,
    LtEq,
    Gt,
    GtEq,
    Not,
    And,
    Or,
    Xor,
    Imp,
    Eqv,
}

Virtual machine instruction set

The BASIC virtual machine has no registers. Every operation is performed on the stack.

For example: LET A=3*B compiles to [Literal(3), Push(B), Mul, Pop(A)]

See https://en.wikipedia.org/wiki/Reverse_Polish_notation

Variants

Literal(Val)

Push literal value on to the stack.

Push(String)

Push stack value of named variable. Infallible.

Pop(String)

Pop stack value to named variable. This is the LET statement and may generate errors.

For(Address)

Jumps to Address if the for-loop on the stack is finished.

Pop stack and branch to Address if not zero.

Jump(Address)

Unconditional branch to Address.

Return

Expect Return(Address) on stack or else error: RETURN WITHOUT GOSUB. Branch to Address.

Clear
Cont
End
Input
List
Print
Stop
Neg
Exp
Mul
Div
DivInt
Mod
Add
Sub
Eq
NotEq
Lt
LtEq
Gt
GtEq
Not
And
Or
Xor
Imp
Eqv

Trait Implementations

impl Debug for Op[src]

impl Display for Op[src]

Auto Trait Implementations

impl RefUnwindSafe for Op

impl Send for Op

impl Sync for Op

impl Unpin for Op

impl UnwindSafe for Op

Blanket Implementations

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

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

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

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

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

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.