Skip to content

Instantly share code, notes, and snippets.

@cedricporter
Last active August 29, 2015 14:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cedricporter/311fbb59e1fb26c4f480 to your computer and use it in GitHub Desktop.
Save cedricporter/311fbb59e1fb26c4f480 to your computer and use it in GitHub Desktop.
Python Opcode translator for Emacs
; Made by Stupid ET <et@everet.org>
(progn
(replace-string "[opcode: 0]" "[opcode: 0 STOP_CODE]")
(beginning-of-buffer)
(replace-string "[opcode: 1]" "[opcode: 1 POP_TOP]")
(beginning-of-buffer)
(replace-string "[opcode: 2]" "[opcode: 2 ROT_TWO]")
(beginning-of-buffer)
(replace-string "[opcode: 3]" "[opcode: 3 ROT_THREE]")
(beginning-of-buffer)
(replace-string "[opcode: 4]" "[opcode: 4 DUP_TOP]")
(beginning-of-buffer)
(replace-string "[opcode: 5]" "[opcode: 5 ROT_FOUR]")
(beginning-of-buffer)
(replace-string "[opcode: 9]" "[opcode: 9 NOP]")
(beginning-of-buffer)
(replace-string "[opcode: 10]" "[opcode: 10 UNARY_POSITIVE]")
(beginning-of-buffer)
(replace-string "[opcode: 11]" "[opcode: 11 UNARY_NEGATIVE]")
(beginning-of-buffer)
(replace-string "[opcode: 12]" "[opcode: 12 UNARY_NOT]")
(beginning-of-buffer)
(replace-string "[opcode: 13]" "[opcode: 13 UNARY_CONVERT]")
(beginning-of-buffer)
(replace-string "[opcode: 15]" "[opcode: 15 UNARY_INVERT]")
(beginning-of-buffer)
(replace-string "[opcode: 19]" "[opcode: 19 BINARY_POWER]")
(beginning-of-buffer)
(replace-string "[opcode: 20]" "[opcode: 20 BINARY_MULTIPLY]")
(beginning-of-buffer)
(replace-string "[opcode: 21]" "[opcode: 21 BINARY_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 22]" "[opcode: 22 BINARY_MODULO]")
(beginning-of-buffer)
(replace-string "[opcode: 23]" "[opcode: 23 BINARY_ADD]")
(beginning-of-buffer)
(replace-string "[opcode: 24]" "[opcode: 24 BINARY_SUBTRACT]")
(beginning-of-buffer)
(replace-string "[opcode: 25]" "[opcode: 25 BINARY_SUBSCR]")
(beginning-of-buffer)
(replace-string "[opcode: 26]" "[opcode: 26 BINARY_FLOOR_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 27]" "[opcode: 27 BINARY_TRUE_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 28]" "[opcode: 28 INPLACE_FLOOR_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 29]" "[opcode: 29 INPLACE_TRUE_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 30]" "[opcode: 30 SLICE+0]")
(beginning-of-buffer)
(replace-string "[opcode: 31]" "[opcode: 31 SLICE+1]")
(beginning-of-buffer)
(replace-string "[opcode: 32]" "[opcode: 32 SLICE+2]")
(beginning-of-buffer)
(replace-string "[opcode: 33]" "[opcode: 33 SLICE+3]")
(beginning-of-buffer)
(replace-string "[opcode: 40]" "[opcode: 40 STORE_SLICE+0]")
(beginning-of-buffer)
(replace-string "[opcode: 41]" "[opcode: 41 STORE_SLICE+1]")
(beginning-of-buffer)
(replace-string "[opcode: 42]" "[opcode: 42 STORE_SLICE+2]")
(beginning-of-buffer)
(replace-string "[opcode: 43]" "[opcode: 43 STORE_SLICE+3]")
(beginning-of-buffer)
(replace-string "[opcode: 50]" "[opcode: 50 DELETE_SLICE+0]")
(beginning-of-buffer)
(replace-string "[opcode: 51]" "[opcode: 51 DELETE_SLICE+1]")
(beginning-of-buffer)
(replace-string "[opcode: 52]" "[opcode: 52 DELETE_SLICE+2]")
(beginning-of-buffer)
(replace-string "[opcode: 53]" "[opcode: 53 DELETE_SLICE+3]")
(beginning-of-buffer)
(replace-string "[opcode: 54]" "[opcode: 54 STORE_MAP]")
(beginning-of-buffer)
(replace-string "[opcode: 55]" "[opcode: 55 INPLACE_ADD]")
(beginning-of-buffer)
(replace-string "[opcode: 56]" "[opcode: 56 INPLACE_SUBTRACT]")
(beginning-of-buffer)
(replace-string "[opcode: 57]" "[opcode: 57 INPLACE_MULTIPLY]")
(beginning-of-buffer)
(replace-string "[opcode: 58]" "[opcode: 58 INPLACE_DIVIDE]")
(beginning-of-buffer)
(replace-string "[opcode: 59]" "[opcode: 59 INPLACE_MODULO]")
(beginning-of-buffer)
(replace-string "[opcode: 60]" "[opcode: 60 STORE_SUBSCR]")
(beginning-of-buffer)
(replace-string "[opcode: 61]" "[opcode: 61 DELETE_SUBSCR]")
(beginning-of-buffer)
(replace-string "[opcode: 62]" "[opcode: 62 BINARY_LSHIFT]")
(beginning-of-buffer)
(replace-string "[opcode: 63]" "[opcode: 63 BINARY_RSHIFT]")
(beginning-of-buffer)
(replace-string "[opcode: 64]" "[opcode: 64 BINARY_AND]")
(beginning-of-buffer)
(replace-string "[opcode: 65]" "[opcode: 65 BINARY_XOR]")
(beginning-of-buffer)
(replace-string "[opcode: 66]" "[opcode: 66 BINARY_OR]")
(beginning-of-buffer)
(replace-string "[opcode: 67]" "[opcode: 67 INPLACE_POWER]")
(beginning-of-buffer)
(replace-string "[opcode: 68]" "[opcode: 68 GET_ITER]")
(beginning-of-buffer)
(replace-string "[opcode: 70]" "[opcode: 70 PRINT_EXPR]")
(beginning-of-buffer)
(replace-string "[opcode: 71]" "[opcode: 71 PRINT_ITEM]")
(beginning-of-buffer)
(replace-string "[opcode: 72]" "[opcode: 72 PRINT_NEWLINE]")
(beginning-of-buffer)
(replace-string "[opcode: 73]" "[opcode: 73 PRINT_ITEM_TO]")
(beginning-of-buffer)
(replace-string "[opcode: 74]" "[opcode: 74 PRINT_NEWLINE_TO]")
(beginning-of-buffer)
(replace-string "[opcode: 75]" "[opcode: 75 INPLACE_LSHIFT]")
(beginning-of-buffer)
(replace-string "[opcode: 76]" "[opcode: 76 INPLACE_RSHIFT]")
(beginning-of-buffer)
(replace-string "[opcode: 77]" "[opcode: 77 INPLACE_AND]")
(beginning-of-buffer)
(replace-string "[opcode: 78]" "[opcode: 78 INPLACE_XOR]")
(beginning-of-buffer)
(replace-string "[opcode: 79]" "[opcode: 79 INPLACE_OR]")
(beginning-of-buffer)
(replace-string "[opcode: 80]" "[opcode: 80 BREAK_LOOP]")
(beginning-of-buffer)
(replace-string "[opcode: 81]" "[opcode: 81 WITH_CLEANUP]")
(beginning-of-buffer)
(replace-string "[opcode: 82]" "[opcode: 82 LOAD_LOCALS]")
(beginning-of-buffer)
(replace-string "[opcode: 83]" "[opcode: 83 RETURN_VALUE]")
(beginning-of-buffer)
(replace-string "[opcode: 84]" "[opcode: 84 IMPORT_STAR]")
(beginning-of-buffer)
(replace-string "[opcode: 85]" "[opcode: 85 EXEC_STMT]")
(beginning-of-buffer)
(replace-string "[opcode: 86]" "[opcode: 86 YIELD_VALUE]")
(beginning-of-buffer)
(replace-string "[opcode: 87]" "[opcode: 87 POP_BLOCK]")
(beginning-of-buffer)
(replace-string "[opcode: 88]" "[opcode: 88 END_FINALLY]")
(beginning-of-buffer)
(replace-string "[opcode: 89]" "[opcode: 89 BUILD_CLASS]")
(beginning-of-buffer)
(replace-string "[opcode: 90]" "[opcode: 90 STORE_NAME]")
(beginning-of-buffer)
(replace-string "[opcode: 91]" "[opcode: 91 DELETE_NAME]")
(beginning-of-buffer)
(replace-string "[opcode: 92]" "[opcode: 92 UNPACK_SEQUENCE]")
(beginning-of-buffer)
(replace-string "[opcode: 93]" "[opcode: 93 FOR_ITER]")
(beginning-of-buffer)
(replace-string "[opcode: 94]" "[opcode: 94 LIST_APPEND]")
(beginning-of-buffer)
(replace-string "[opcode: 95]" "[opcode: 95 STORE_ATTR]")
(beginning-of-buffer)
(replace-string "[opcode: 96]" "[opcode: 96 DELETE_ATTR]")
(beginning-of-buffer)
(replace-string "[opcode: 97]" "[opcode: 97 STORE_GLOBAL]")
(beginning-of-buffer)
(replace-string "[opcode: 98]" "[opcode: 98 DELETE_GLOBAL]")
(beginning-of-buffer)
(replace-string "[opcode: 99]" "[opcode: 99 DUP_TOPX]")
(beginning-of-buffer)
(replace-string "[opcode: 100]" "[opcode: 100 LOAD_CONST]")
(beginning-of-buffer)
(replace-string "[opcode: 101]" "[opcode: 101 LOAD_NAME]")
(beginning-of-buffer)
(replace-string "[opcode: 102]" "[opcode: 102 BUILD_TUPLE]")
(beginning-of-buffer)
(replace-string "[opcode: 103]" "[opcode: 103 BUILD_LIST]")
(beginning-of-buffer)
(replace-string "[opcode: 104]" "[opcode: 104 BUILD_SET]")
(beginning-of-buffer)
(replace-string "[opcode: 105]" "[opcode: 105 BUILD_MAP]")
(beginning-of-buffer)
(replace-string "[opcode: 106]" "[opcode: 106 LOAD_ATTR]")
(beginning-of-buffer)
(replace-string "[opcode: 107]" "[opcode: 107 COMPARE_OP]")
(beginning-of-buffer)
(replace-string "[opcode: 108]" "[opcode: 108 IMPORT_NAME]")
(beginning-of-buffer)
(replace-string "[opcode: 109]" "[opcode: 109 IMPORT_FROM]")
(beginning-of-buffer)
(replace-string "[opcode: 110]" "[opcode: 110 JUMP_FORWARD]")
(beginning-of-buffer)
(replace-string "[opcode: 111]" "[opcode: 111 JUMP_IF_FALSE_OR_POP]")
(beginning-of-buffer)
(replace-string "[opcode: 112]" "[opcode: 112 JUMP_IF_TRUE_OR_POP]")
(beginning-of-buffer)
(replace-string "[opcode: 113]" "[opcode: 113 JUMP_ABSOLUTE]")
(beginning-of-buffer)
(replace-string "[opcode: 114]" "[opcode: 114 POP_JUMP_IF_FALSE]")
(beginning-of-buffer)
(replace-string "[opcode: 115]" "[opcode: 115 POP_JUMP_IF_TRUE]")
(beginning-of-buffer)
(replace-string "[opcode: 116]" "[opcode: 116 LOAD_GLOBAL]")
(beginning-of-buffer)
(replace-string "[opcode: 119]" "[opcode: 119 CONTINUE_LOOP]")
(beginning-of-buffer)
(replace-string "[opcode: 120]" "[opcode: 120 SETUP_LOOP]")
(beginning-of-buffer)
(replace-string "[opcode: 121]" "[opcode: 121 SETUP_EXCEPT]")
(beginning-of-buffer)
(replace-string "[opcode: 122]" "[opcode: 122 SETUP_FINALLY]")
(beginning-of-buffer)
(replace-string "[opcode: 124]" "[opcode: 124 LOAD_FAST]")
(beginning-of-buffer)
(replace-string "[opcode: 125]" "[opcode: 125 STORE_FAST]")
(beginning-of-buffer)
(replace-string "[opcode: 126]" "[opcode: 126 DELETE_FAST]")
(beginning-of-buffer)
(replace-string "[opcode: 130]" "[opcode: 130 RAISE_VARARGS]")
(beginning-of-buffer)
(replace-string "[opcode: 131]" "[opcode: 131 CALL_FUNCTION]")
(beginning-of-buffer)
(replace-string "[opcode: 132]" "[opcode: 132 MAKE_FUNCTION]")
(beginning-of-buffer)
(replace-string "[opcode: 133]" "[opcode: 133 BUILD_SLICE]")
(beginning-of-buffer)
(replace-string "[opcode: 134]" "[opcode: 134 MAKE_CLOSURE]")
(beginning-of-buffer)
(replace-string "[opcode: 135]" "[opcode: 135 LOAD_CLOSURE]")
(beginning-of-buffer)
(replace-string "[opcode: 136]" "[opcode: 136 LOAD_DEREF]")
(beginning-of-buffer)
(replace-string "[opcode: 137]" "[opcode: 137 STORE_DEREF]")
(beginning-of-buffer)
(replace-string "[opcode: 140]" "[opcode: 140 CALL_FUNCTION_VAR]")
(beginning-of-buffer)
(replace-string "[opcode: 141]" "[opcode: 141 CALL_FUNCTION_KW]")
(beginning-of-buffer)
(replace-string "[opcode: 142]" "[opcode: 142 CALL_FUNCTION_VAR_KW]")
(beginning-of-buffer)
(replace-string "[opcode: 143]" "[opcode: 143 SETUP_WITH]")
(beginning-of-buffer)
(replace-string "[opcode: 145]" "[opcode: 145 EXTENDED_ARG]")
(beginning-of-buffer)
(replace-string "[opcode: 146]" "[opcode: 146 SET_ADD]")
(beginning-of-buffer)
(replace-string "[opcode: 147]" "[opcode: 147 MAP_ADD]")
(beginning-of-buffer)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment