.
This commit is contained in:
43
doc/VM
Normal file
43
doc/VM
Normal file
@@ -0,0 +1,43 @@
|
||||
Supported types
|
||||
---------------
|
||||
Nil
|
||||
Integer
|
||||
Float
|
||||
String
|
||||
Array
|
||||
Table
|
||||
Function
|
||||
NativePointer
|
||||
|
||||
Operations
|
||||
----------
|
||||
|
||||
Stack operations:
|
||||
pshn [int] Push int
|
||||
pshz Push zero (or false)
|
||||
psht Push true
|
||||
pshr [float] Push float (real)
|
||||
pshs [string] Push string
|
||||
pshf [function] Push function
|
||||
newa [array] Push (create) empty array
|
||||
newt [table] Push (create) empty table
|
||||
pop
|
||||
dup
|
||||
|
||||
Local variables:
|
||||
setl [int] Set stack top as indexed local variable
|
||||
getl [int] Get indexed local variable and place on stack
|
||||
|
||||
Function operations:
|
||||
call [n_pars] Enter function on stack toplevel (passing n next stack values as parameters)
|
||||
ret Leave a function (return value in stack)
|
||||
retn Leave a function (return nil)
|
||||
|
||||
Control flow:
|
||||
bz [pc] Branch if zero
|
||||
bnz [pc] Branch if not zero
|
||||
jmp [pc] Unconditional jump
|
||||
|
||||
Logical/arithmetic
|
||||
sum Sum top 2 values in stack
|
||||
mul Multiply top 2 values in stack
|
||||
Reference in New Issue
Block a user