Documentation
¶
Overview ¶
pygo exposes an API to interpret Python bytecode.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Code ¶
type Code struct { Prog []Instruction // Prog is the set of instructions to execute. Numbers []int // Numbers is the data being manipulated by the program. Names []string // Names is the list of variables' names. }
Code is a complete bytecompiled program together with data.
type Instruction ¶
type Instruction interface{}
Instruction is a single instruction in a bytecode stream.
type Interpreter ¶
type Interpreter struct {
// contains filtered or unexported fields
}
Interpreter interprets instructions for the pygo interpreter.
func (*Interpreter) Run ¶
func (interp *Interpreter) Run(code Code)
Run interprets code compiled to bytecode by some means.
type Opcode ¶
type Opcode byte
Opcode is a single bytecode operation for the Python interpreter. Operands (if any) for the opcode follow in the bytecode stream.
const ( Op_000 Opcode = 0 Op_POP_TOP Opcode = 1 Op_ROT_TWO Opcode = 2 Op_ROT_THREE Opcode = 3 Op_DUP_TOP Opcode = 4 Op_DUP_TOP_TWO Opcode = 5 Op_006 Opcode = 6 Op_007 Opcode = 7 Op_008 Opcode = 8 Op_NOP Opcode = 9 Op_UNARY_POSITIVE Opcode = 10 Op_UNARY_NEGATIVE Opcode = 11 Op_UNARY_NOT Opcode = 12 Op_013 Opcode = 13 Op_014 Opcode = 14 Op_UNARY_INVERT Opcode = 15 Op_BINARY_MATRIX_MULTIPLY Opcode = 16 Op_INPLACE_MATRIX_MULTIPLY Opcode = 17 Op_018 Opcode = 18 Op_BINARY_POWER Opcode = 19 Op_BINARY_MULTIPLY Opcode = 20 Op_021 Opcode = 21 Op_BINARY_MODULO Opcode = 22 Op_BINARY_ADD Opcode = 23 Op_BINARY_SUBTRACT Opcode = 24 Op_BINARY_SUBSCR Opcode = 25 Op_BINARY_FLOOR_DIVIDE Opcode = 26 Op_BINARY_TRUE_DIVIDE Opcode = 27 Op_INPLACE_FLOOR_DIVIDE Opcode = 28 Op_INPLACE_TRUE_DIVIDE Opcode = 29 Op_030 Opcode = 30 Op_031 Opcode = 31 Op_032 Opcode = 32 Op_033 Opcode = 33 Op_034 Opcode = 34 Op_035 Opcode = 35 Op_036 Opcode = 36 Op_037 Opcode = 37 Op_038 Opcode = 38 Op_039 Opcode = 39 Op_040 Opcode = 40 Op_041 Opcode = 41 Op_042 Opcode = 42 Op_043 Opcode = 43 Op_044 Opcode = 44 Op_045 Opcode = 45 Op_046 Opcode = 46 Op_047 Opcode = 47 Op_048 Opcode = 48 Op_049 Opcode = 49 Op_GET_AITER Opcode = 50 Op_GET_ANEXT Opcode = 51 Op_BEFORE_ASYNC_WITH Opcode = 52 Op_053 Opcode = 53 Op_054 Opcode = 54 Op_INPLACE_ADD Opcode = 55 Op_INPLACE_SUBTRACT Opcode = 56 Op_INPLACE_MULTIPLY Opcode = 57 Op_058 Opcode = 58 Op_INPLACE_MODULO Opcode = 59 Op_STORE_SUBSCR Opcode = 60 Op_DELETE_SUBSCR Opcode = 61 Op_BINARY_LSHIFT Opcode = 62 Op_BINARY_RSHIFT Opcode = 63 Op_BINARY_AND Opcode = 64 Op_BINARY_XOR Opcode = 65 Op_BINARY_OR Opcode = 66 Op_INPLACE_POWER Opcode = 67 Op_GET_ITER Opcode = 68 Op_GET_YIELD_FROM_ITER Opcode = 69 Op_PRINT_EXPR Opcode = 70 Op_LOAD_BUILD_CLASS Opcode = 71 Op_YIELD_FROM Opcode = 72 Op_GET_AWAITABLE Opcode = 73 Op_074 Opcode = 74 Op_INPLACE_LSHIFT Opcode = 75 Op_INPLACE_RSHIFT Opcode = 76 Op_INPLACE_AND Opcode = 77 Op_INPLACE_XOR Opcode = 78 Op_INPLACE_OR Opcode = 79 Op_BREAK_LOOP Opcode = 80 Op_WITH_CLEANUP_START Opcode = 81 Op_WITH_CLEANUP_FINISH Opcode = 82 Op_RETURN_VALUE Opcode = 83 Op_IMPORT_STAR Opcode = 84 Op_085 Opcode = 85 Op_YIELD_VALUE Opcode = 86 Op_POP_BLOCK Opcode = 87 Op_END_FINALLY Opcode = 88 Op_POP_EXCEPT Opcode = 89 Op_STORE_NAME Opcode = 90 Op_DELETE_NAME Opcode = 91 Op_UNPACK_SEQUENCE Opcode = 92 Op_FOR_ITER Opcode = 93 Op_UNPACK_EX Opcode = 94 Op_STORE_ATTR Opcode = 95 Op_DELETE_ATTR Opcode = 96 Op_STORE_GLOBAL Opcode = 97 Op_DELETE_GLOBAL Opcode = 98 Op_099 Opcode = 99 Op_LOAD_CONST Opcode = 100 Op_LOAD_NAME Opcode = 101 Op_BUILD_TUPLE Opcode = 102 Op_BUILD_LIST Opcode = 103 Op_BUILD_SET Opcode = 104 Op_BUILD_MAP Opcode = 105 Op_LOAD_ATTR Opcode = 106 Op_COMPARE_OP Opcode = 107 Op_IMPORT_NAME Opcode = 108 Op_IMPORT_FROM Opcode = 109 Op_JUMP_FORWARD Opcode = 110 Op_JUMP_IF_FALSE_OR_POP Opcode = 111 Op_JUMP_IF_TRUE_OR_POP Opcode = 112 Op_JUMP_ABSOLUTE Opcode = 113 Op_POP_JUMP_IF_FALSE Opcode = 114 Op_POP_JUMP_IF_TRUE Opcode = 115 Op_LOAD_GLOBAL Opcode = 116 Op_117 Opcode = 117 Op_118 Opcode = 118 Op_CONTINUE_LOOP Opcode = 119 Op_SETUP_LOOP Opcode = 120 Op_SETUP_EXCEPT Opcode = 121 Op_SETUP_FINALLY Opcode = 122 Op_123 Opcode = 123 Op_LOAD_FAST Opcode = 124 Op_STORE_FAST Opcode = 125 Op_DELETE_FAST Opcode = 126 Op_127 Opcode = 127 Op_128 Opcode = 128 Op_129 Opcode = 129 Op_RAISE_VARARGS Opcode = 130 Op_CALL_FUNCTION Opcode = 131 Op_MAKE_FUNCTION Opcode = 132 Op_BUILD_SLICE Opcode = 133 Op_MAKE_CLOSURE Opcode = 134 Op_LOAD_CLOSURE Opcode = 135 Op_LOAD_DEREF Opcode = 136 Op_STORE_DEREF Opcode = 137 Op_DELETE_DEREF Opcode = 138 Op_139 Opcode = 139 Op_CALL_FUNCTION_VAR Opcode = 140 Op_CALL_FUNCTION_KW Opcode = 141 Op_CALL_FUNCTION_VAR_KW Opcode = 142 Op_SETUP_WITH Opcode = 143 Op_EXTENDED_ARG Opcode = 144 Op_LIST_APPEND Opcode = 145 Op_SET_ADD Opcode = 146 Op_MAP_ADD Opcode = 147 Op_LOAD_CLASSDEREF Opcode = 148 Op_BUILD_LIST_UNPACK Opcode = 149 Op_BUILD_MAP_UNPACK Opcode = 150 Op_BUILD_MAP_UNPACK_WITH_CALL Opcode = 151 Op_BUILD_TUPLE_UNPACK Opcode = 152 Op_BUILD_SET_UNPACK Opcode = 153 Op_SETUP_ASYNC_WITH Opcode = 154 Op_155 Opcode = 155 Op_156 Opcode = 156 Op_157 Opcode = 157 Op_158 Opcode = 158 Op_159 Opcode = 159 Op_160 Opcode = 160 Op_161 Opcode = 161 Op_162 Opcode = 162 Op_163 Opcode = 163 Op_164 Opcode = 164 Op_165 Opcode = 165 Op_166 Opcode = 166 Op_167 Opcode = 167 Op_168 Opcode = 168 Op_169 Opcode = 169 Op_170 Opcode = 170 Op_171 Opcode = 171 Op_172 Opcode = 172 Op_173 Opcode = 173 Op_174 Opcode = 174 Op_175 Opcode = 175 Op_176 Opcode = 176 Op_177 Opcode = 177 Op_178 Opcode = 178 Op_179 Opcode = 179 Op_180 Opcode = 180 Op_181 Opcode = 181 Op_182 Opcode = 182 Op_183 Opcode = 183 Op_184 Opcode = 184 Op_185 Opcode = 185 Op_186 Opcode = 186 Op_187 Opcode = 187 Op_188 Opcode = 188 Op_189 Opcode = 189 Op_190 Opcode = 190 Op_191 Opcode = 191 Op_192 Opcode = 192 Op_193 Opcode = 193 Op_194 Opcode = 194 Op_195 Opcode = 195 Op_196 Opcode = 196 Op_197 Opcode = 197 Op_198 Opcode = 198 Op_199 Opcode = 199 Op_200 Opcode = 200 Op_201 Opcode = 201 Op_202 Opcode = 202 Op_203 Opcode = 203 Op_204 Opcode = 204 Op_205 Opcode = 205 Op_206 Opcode = 206 Op_207 Opcode = 207 Op_208 Opcode = 208 Op_209 Opcode = 209 Op_210 Opcode = 210 Op_211 Opcode = 211 Op_212 Opcode = 212 Op_213 Opcode = 213 Op_214 Opcode = 214 Op_215 Opcode = 215 Op_216 Opcode = 216 Op_217 Opcode = 217 Op_218 Opcode = 218 Op_219 Opcode = 219 Op_220 Opcode = 220 Op_221 Opcode = 221 Op_222 Opcode = 222 Op_223 Opcode = 223 Op_224 Opcode = 224 Op_225 Opcode = 225 Op_226 Opcode = 226 Op_227 Opcode = 227 Op_228 Opcode = 228 Op_229 Opcode = 229 Op_230 Opcode = 230 Op_231 Opcode = 231 Op_232 Opcode = 232 Op_233 Opcode = 233 Op_234 Opcode = 234 Op_235 Opcode = 235 Op_236 Opcode = 236 Op_237 Opcode = 237 Op_238 Opcode = 238 Op_239 Opcode = 239 Op_240 Opcode = 240 Op_241 Opcode = 241 Op_242 Opcode = 242 Op_243 Opcode = 243 Op_244 Opcode = 244 Op_245 Opcode = 245 Op_246 Opcode = 246 Op_247 Opcode = 247 Op_248 Opcode = 248 Op_249 Opcode = 249 Op_250 Opcode = 250 Op_251 Opcode = 251 Op_252 Opcode = 252 Op_253 Opcode = 253 Op_254 Opcode = 254 Op_255 Opcode = 255 )
Python-3 Opcodes
Click to show internal directories.
Click to hide internal directories.