A Register-based VM
test_vm.lisp
(- (+ (- 7 (* 6 (/ 5 (+ (+ 4 3) (+ 2 1))))) 8)
(+ (- 7 (* 6 (/ 5 (+ (+ 4 3) (+ 2 1))))) 8))
test_chunk.vm
== test_chunk.vm ==
registers: [ 0x00000007 0x00000006 0x00000005 0x00000004 0x00000003 0x00000002 0x00000001 0x00000008 0x00000007 0x00000006 0x00000005 0x00000004 0x00000003 0x00000002 0x00000001 0x00000008 ]
instruction count:00000016
0000:03000304 1 OP_ADD
0004:03000506 1 OP_ADD
0008:03000305 1 OP_ADD
000c:06000203 1 OP_DIVIDE
0010:05000102 1 OP_MULTIPLY
0014:04000001 1 OP_SUBTRACT
0018:03000007 1 OP_ADD
001c:03000b0c 1 OP_ADD
0020:03000d0e 1 OP_ADD
0024:03000b0d 1 OP_ADD
0028:06000a0b 1 OP_DIVIDE
002c:0500090a 1 OP_MULTIPLY
0030:04000809 1 OP_SUBTRACT
0034:0300080f 1 OP_ADD
0038:04000008 1 OP_SUBTRACT
003c:07000000 666 OP_RETURN
Result Log
0000:03000304 1 OP_ADD
registers: [ 0x00000007 0x00000006 0x00000005 0x00000004 0x00000003 0x00000002 0x00000001 0x00000008 0x00000007 0x00000006 0x00000005 0x00000004 0x00000003 0x00000002 0x00000001 0x00000008 ]
instruction:0x03000304
index start:3, index end:4
register value: {
0x00000004
0x00000003
}
...
003c:07000000 666 OP_RETURN
registers: [ 0x00000000 0x00000000 0x00000000 0x0000000a 0x00000003 0x00000003 0x00000001 0x00000008 0x0000000f 0x00000000 0x00000000 0x0000000a 0x00000003 0x00000003 0x00000001 0x00000008 ]
0x00000000