Uploading Lua Assembler/Disassembler for Lua 5.2

This commit is contained in:
Andre Murbach Maidl
2013-08-04 10:41:28 -03:00
parent 6c9a9f0cd6
commit 5d2eafb879
13 changed files with 2735 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
function main(0):
CLOSURE $0, fat
SETTABUP _ENV, fat, $0
GETTABUP $0, _ENV, print
GETTABUP $1, _ENV, fat
LOADK $2, 5
CALL $1, 2, 0
CALL $0, 0, 1
RETURN $0, 1
function fat(1):
EQ 0, $0, 0
JMP 0, label1 ; jump to label1
LOADK $1, 1
RETURN $1, 2
label1: GETTABUP $1, _ENV, fat ; create label1
SUB $2, $0, 1
CALL $1, 2, 2
MUL $1, $0, $1
RETURN $1, 2
RETURN $0, 1