Byte array #1

Merged
andre merged 7 commits from bytecode into master 2026-04-27 09:42:03 -05:00
Showing only changes of commit 77fe7745db - Show all commits

43
doc/VM Normal file
View 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