tArgs = {...} insd = {[4095] = "ppc", [4094] = "swp", [4093] = "read", [4092] = "write", [4091] = "add", [4090] = "sub", [4089] = "jmp", [4088] = "sez"} insc = {} insc.ppc = 4095 insc.swp = 4094 insc.read = 4093 insc.write = 4092 insc.add = 4091 insc.sub = 4090 insc.jmp = 4089 insc.sez = 4088 local f=io.open("ins.def","rb") local c = ""; if f then c=f:read("*a") f:close() insd,insc = {}, {} for l in c:gmatch("(.+)\n") do lt = {} for w in l:gmatch("%S+") do table.insert(lt,w) end insc[lt[2]] = tonumber(lt[1]) insd[tonumber(lt[1])] = lt[2] end end if not tArgs[2] then error("requires a file argument and a compile/decompile flag") end f = io.open(tArgs[2],"rb") if not f then error("file inaccessable") end c = f:read("*a") f:close() for w in c:gmatch("%S+") do if tArgs[1] == "-c" then if insc[w] ~= nil then print(insc[w]) else print(w) end elseif tArgs[1] == "-d" then if insd[tonumber(w)] ~= nil then print(insd[tonumber(w)]) else print(w) end end end