TauVM is an educational interpreted stack-based virtual machine written in Rust. Programming on the TauVM makes use of the included StackAssembly interpreter. StackAssembly is a simplified assembly language that is directly interpreted rather than being assembled into bytecode. This documentation is the documentation of the StackAssembly assember language.
The int data type is a 64-bit unsigned integer. Being 64 bits, it takes up 8 bytes.
The bool type can either be true or false. It is used only for conditional jumps.
int.const <int>
None -> int
Pushes an int constant to the stack.
The argument int is parsed as a 64-bit signed integer. This is converted to an 8-byte array which is pushed onto the stack in big-endian format.
int.add
(a: int, b: int) -> int
Adds the two integers on the top of the stack in big-endian format.
int.sub
(a: int, b: int) -> int
Subtracts the two integers on the top of the stack in big-endian format.
int.mul
(a: int, b: int) -> int
Multiplies the two integers on the top of the stack in big-endian format.
int.div
(a: int, b: int) -> int
Divides the two integers on the top of the stack in big-endian format.
int.copy
(a: int) -> (int, int)
Pops the top int of the stack and pushes two of it, effectively copying the value.
int.gt
(a: int, b: int) -> bool
Compares the top integers by greater than.
int.lt
(a: int, b: int) -> bool
Compares the top integers by less than.
int.eq
(a: int, b: int) -> bool
Checks the equality of the top two ints.
int.rot
(a: int, b: int) -> (int, int)
Swaps the top two integers on the stack.
int.local <offset>
None -> int
Gets an int local from a stack frame offset.
checkpoint <name>
None -> None
Sets a checkpoint to later jump to.
goto <checkpoint>
None -> None
Jumps to a checkpoint, whether it is defined before or after.
if <true> <false>
(condition: bool) -> None
If the condition is true, jump to the true checkpoint. Otherwise, jump to false.
jmp
(line: int) -> None
Jumps to an integer line number.
mem.malloc
None -> None
Creates a new memory block.
mem.free
(address: int) -> None
Frees a memory block
stack.init <offset>
None -> None
Initialize a new stack frame and set the frame pointer to the top of the stack + the offset.
stack.pop <save>
None -> bytes
Pops the top frame except for the save amount of bytes.
out.int
(out: int) -> None
Prints the top integer.
debug.dump
None -> None
Dumps the content of the entire stack.
var.usage <name>
(data: bytes, size: int) -> None
Stores a local variable blound to the current stack frame.
var.load <name>
None -> bytes
Loads a local variable by name.