Initial commit
Includes: runtime base from a previous project, syn(tax) module with parser and lexer Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
41
runtime/src/vm/inst.rs
Normal file
41
runtime/src/vm/inst.rs
Normal file
@@ -0,0 +1,41 @@
|
||||
use crate::obj::prelude::*;
|
||||
|
||||
#[derive(Debug, PartialEq)]
|
||||
pub enum Inst {
|
||||
/// Push a literal symbol object to the stack.
|
||||
PushSym(Sym),
|
||||
|
||||
/// Pop a value from the stack, possibly into a local symbol.
|
||||
Pop(Option<Sym>),
|
||||
|
||||
/// Pops a symbol value and an object reference.
|
||||
///
|
||||
/// This will get an attr from the object reference pointed to by the symbol.
|
||||
///
|
||||
/// If the object reference is `:__local__`, this instruction will push a local value.
|
||||
GetAttr,
|
||||
|
||||
/// Pops an object reference, a symbol value, and another object reference.
|
||||
///
|
||||
/// This will set an attr of the second object ref to the first object ref, with the symbol
|
||||
/// value name.
|
||||
///
|
||||
/// If the given value is `:__local__`, this instruction will set a local value.
|
||||
SetAttr,
|
||||
|
||||
/// Jump to a given address in the current function unconditionally.
|
||||
Jump(usize),
|
||||
|
||||
/// Jump to a given address in the current function if the condition flag is true.
|
||||
///
|
||||
/// The condition flag may be set by an internal function.
|
||||
JumpTrue(usize),
|
||||
|
||||
/// Pops the top item off of the stack, followed by the number of arguments supplied, and
|
||||
/// attempts to run the `__call__` attribute of the object.
|
||||
Call(usize),
|
||||
|
||||
/// Pops the top value from the stack, and returns from the function, using the popped value as
|
||||
/// a return value.
|
||||
Return,
|
||||
}
|
||||
Reference in New Issue
Block a user