Initial commit
* Parser, compiler, objects, and VM base implementations * Stuff will print out, functions called, etc * There are probably plenty of bugs but this is a good starting point to start committing changes into git Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
32
src/vm/inst.rs
Normal file
32
src/vm/inst.rs
Normal file
@@ -0,0 +1,32 @@
|
||||
use crate::obj::ObjPtr;
|
||||
use crate::vm::name::Name;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Inst {
|
||||
/// Pushes an object to the stack.
|
||||
Push(ObjPtr),
|
||||
|
||||
/// Loads a local value in a name and pushes it to the stack.
|
||||
Load(Name),
|
||||
|
||||
/// Pops the top item off of the stack and stores it in a name.
|
||||
Store(Name),
|
||||
|
||||
/// Get an attribute from the top item of the stack.
|
||||
GetAttr(String),
|
||||
|
||||
/// Pops the top item off of the stack, discarding it.
|
||||
Pop,
|
||||
|
||||
/// Pops the top N function arguments off the stack, and attempt to call the
|
||||
/// next stack item.
|
||||
Call(usize),
|
||||
|
||||
/// Exits the current function stack frame and returns control to the
|
||||
/// calling function.
|
||||
///
|
||||
/// This will take the last value on top of the stack (the return value),
|
||||
/// resize the stack to its last size (pre-call), and push the return value
|
||||
/// back to the top of the stack.
|
||||
Return,
|
||||
}
|
||||
Reference in New Issue
Block a user