[−][src]Crate stk
STK, a simple stack-based virtual machine.
Contributing
If you want to help out, there's a number of optimization tasks available in Future Optimizations.
Create an issue about the optimization you want to work on and communicate that you are working on it.
Features of stk
- Clean Rust FFI.
- Stack-based C FFI like with Lua (TBD).
- Stack frames, allowing for isolation across function calls.
- A rust-like reference language called Rune.
Rune Scripts
stk comes with a simple scripting language called Rune.
You can run example scripts through rune-cli:
cargo run -- ./scripts/hello_world.rn
If you want to see diagnostics of your unit, you can do:
cargo run -- ./scripts/hello_world.rn --dump-unit --trace
Re-exports
pub use crate::unit::CompilationUnit; |
pub use crate::unit::CompilationUnitError; |
Modules
packages | Public packages that can be used to provide functionality to virtual machines. |
tls | Utilities for storing and accessing the virtual machine from thread-local storage. |
unit | A single execution unit in the stk virtual machine. |
Macros
decl_external | Implement the value trait for an external type. |
Structs
Any | Our own private dynamic Any implementation. |
Context | Static run context visible to the virtual machine. |
Error | An error raised from a user functions. |
Hash | The hash of a primitive thing. |
Item | The name of an item. |
Module | A collection of functions that can be looked up by type. |
Mut | Guard for a value exclusively borrowed from a slot in the virtual machine. |
RawMutGuard | A raw mutable guard. |
RawRefGuard | A raw reference guard. |
Ref | Guard for a value borrowed from a slot in the virtual machine. |
Slot | Compact information on typed slot. |
Task | The task of a unit being run. |
Unit | The rust type corresponding to rune's |
Vm | A stack which references variables indirectly from a slab. |
Enums
ContextError | An error raised when building the context. |
Inst | An operation in the stack-based virtual machine. |
Panic | The reason why a panic was invoked in the virtual machine. |
StackError | An error raised when interacting with types on the stack. |
Value | A value peeked out of the stack. |
ValuePtr | An entry on the stack. |
ValueRef | A value peeked out of the stack. |
ValueType | The type of an entry. |
ValueTypeInfo | Type information about a value, that can be printed for human consumption through its Display implementation. |
VmError | Errors raised by the execution of the virtual machine. |
Constants
ADD | The function to implement for the addition operation. |
ADD_ASSIGN | The function to implement for the addition assign operation. |
DIV | The function to implement for the division operation. |
DIV_ASSIGN | The function to implement for the division assign operation. |
INDEX_GET | The function to access an index. |
INDEX_SET | The function to set an index. |
MUL | The function to implement for the multiply operation. |
MUL_ASSIGN | The function to implement for the multiply assign operation. |
NEXT | The function to call to continue iteration. |
SUB | The function to implement for the subtraction operation. |
SUB_ASSIGN | The function to implement for the subtraction assign operation. |
Traits
FromValue | Trait for converting from a value. |
IntoArgs | Trait for converting arguments into values. |
ReflectValueType | Trait for converting types into values. |
ToValue | Trait for converting types into values. |
UnsafeFromValue | A potentially unsafe conversion for value conversion. |
UnsafeToValue | Trait for unsafe conversion of value types into values. |
Type Definitions
Array | The type of an array. |
Object | The type of an object. |
Result | Result alias for the stk crate. |