ZS> Alright, I'll read through that. I guess I should probably
start with
writing a disassembler then.
For Lua? There is one already. Read the docs for luac.
You can experiment with WebLua:
http://doris.sourceforge.net/lua/weblua.php
E.g.,
Lua script:
for i=1,10 do print(i) end
luac generates the follow output:
main <0:@/tmp/wlTCSViV> (9 instructions/36 bytes at 0x8052af0)
0 params, 5 stacks, 3 locals, 1 string, 0 numbers, 0 functions, 3 lines
1 [2] PUSHINT 1
2 [2] PUSHINT 10
3 [2] PUSHINT 1
4 [2] FORPREP 4 ; to 9
5 [2] GETGLOBAL 0 ; print
6 [2] GETLOCAL 0 ; i
7 [2] CALL 3 0
8 [2] FORLOOP -4 ; to 5
9 [2] END