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:
2020-09-01 17:32:48 -07:00
commit 178ed4a952
24 changed files with 1139 additions and 0 deletions

41
runtime/src/vm/inst.rs Normal file
View 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,
}