Explore Enterprise Education Gitee Premium Gitee AI AI teammates
Fetch the repository succeeded.
Donate
Please sign in before you donate.
Scan WeChat QR to Pay
Cancel
Complete
Prompt
Switch to Alipay.
OK
Cancel
1 Star 0 Fork 86

yjcf/pythonvm

forked from hinus/pythonvm
Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
Already have an account? Sign in
文件
master
Branches (2)
Tags (3)
master
geektime
chapter4_final
chapter3_cmake
chapter3_parser
master
Branches (2)
Tags (3)
master
geektime
chapter4_final
chapter3_cmake
chapter3_parser
Clone or Download
Clone/Download
Prompt
To download the code, please copy the following command and execute it in the terminal
To ensure that your submitted code identity is correctly recognized by Gitee, please execute the following command.
When using the SSH protocol for the first time to clone or push code, follow the prompts below to complete the SSH configuration.
1 Generate RSA keys.
2 Obtain the content of the RSA public key and configure it in SSH Public Keys
To use SVN on Gitee, please visit the usage guide
When using the HTTPS protocol, the command line will prompt for account and password verification as follows. For security reasons, Gitee recommends configure and use personal access tokens instead of login passwords for cloning, pushing, and other operations.
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # Private Token
master
Branches (2)
Tags (3)
master
geektime
chapter4_final
chapter3_cmake
chapter3_parser
pythonvm
/
src
/
code
/
bytecode.hpp
pythonvm
/
src
/
code
/
bytecode.hpp
bytecode.hpp 4.22 KB
Copy Edit Raw Blame History
hinus authored 2018年10月10日 10:27 +08:00 . Summary: generator
#ifndef BYTE_CODE_HPP
#define BYTE_CODE_HPP
class ByteCode {
public:
// Define org.railgun.vm.Bytecode Operator Code
static const unsigned char POP_TOP = 1;
static const unsigned char ROT_TWO = 2;
static const unsigned char ROT_THREE = 3;
static const unsigned char DUP_TOP = 4;
static const unsigned char UNARY_NEGATIVE = 11;
static const unsigned char BINARY_MULTIPLY = 20;
static const unsigned char BINARY_MODULO = 22;
static const unsigned char BINARY_SUBSCR = 25;
static const unsigned char BINARY_DIVIDE = 21;
static const unsigned char BINARY_ADD = 23;
static const unsigned char BINARY_SUBTRACT = 24;
static const unsigned char INPLACE_ADD = 55;
static const unsigned char STORE_MAP = 54;
static const unsigned char INPLACE_SUBSTRACT = 56;
static const unsigned char INPLACE_MULTIPLY = 57;
static const unsigned char INPLACE_DIVIDE = 58;
static const unsigned char INPLACE_MODULO = 59;
static const unsigned char STORE_SUBSCR = 60;
static const unsigned char DELETE_SUBSCR = 61;
static const unsigned char GET_ITER = 68;
static const unsigned char PRINT_ITEM = 71;
static const unsigned char PRINT_NEWLINE = 72;
static const unsigned char BREAK_LOOP = 80;
static const unsigned char LOAD_LOCALS = 82;
static const unsigned char RETURN_VALUE = 83;
static const unsigned char YIELD_VALUE = 86;
static const unsigned char POP_BLOCK = 87;
static const unsigned char END_FINALLY = 88;
static const unsigned char BUILD_CLASS = 89;
// TODO: This is a separator
static const unsigned char HAVE_ARGUMENT = 90; /* Opcodes from here have an argument: */
static const unsigned char STORE_NAME = 90; /* Index in name list */
static const unsigned char UNPACK_SEQUENCE = 92;
static const unsigned char FOR_ITER = 93;
static const unsigned char STORE_ATTR = 95; /* Index in name list */
static const unsigned char STORE_GLOBAL = 97;
static const unsigned char DUP_TOPX = 99; /* number of items to duplicate */
static const unsigned char LOAD_CONST = 100; /* Index in const list */
static const unsigned char LOAD_NAME = 101; /* Index in name list */
static const unsigned char BUILD_TUPLE = 102;
static const unsigned char BUILD_LIST = 103;
static const unsigned char BUILD_MAP = 105;
static const unsigned char LOAD_ATTR = 106; /* Index in name list */
static const unsigned char COMPARE_OP = 107; /* Comparison operator */
static const unsigned char IMPORT_NAME = 108; /* Index in name list */
static const unsigned char IMPORT_FROM = 109; /* Index in name list */
static const unsigned char JUMP_FORWARD = 110; /* Number of bytes to skip */
static const unsigned char JUMP_IF_FALSE_OR_POP = 111; /* Target byte offset from beginning
of code */
static const unsigned char JUMP_ABSOLUTE = 113;
static const unsigned char POP_JUMP_IF_FALSE = 114;
static const unsigned char POP_JUMP_IF_TRUE = 115;
static const unsigned char LOAD_GLOBAL = 116; /* Index in name list */
static const unsigned char CONTINUE_LOOP = 119; /* Start of loop (absolute) */
static const unsigned char SETUP_LOOP = 120; /* Target address (relative) */
static const unsigned char SETUP_EXCEPT = 121; /* "" */
static const unsigned char SETUP_FINALLY = 122; /* "" */
static const unsigned char LOAD_FAST = 124; /* Local variable number */
static const unsigned char STORE_FAST = 125; /* Local variable number */
static const unsigned char RAISE_VARARGS = 130;
static const unsigned char CALL_FUNCTION = 131;
static const unsigned char MAKE_FUNCTION = 132;
static const unsigned char MAKE_CLOSURE = 134; /* #free vars */
static const unsigned char LOAD_CLOSURE = 135; /* Load free variable from closure */
static const unsigned char LOAD_DEREF = 136; /* Load and dereference from closure cell */
static const unsigned char STORE_DEREF = 137; /* Store into cell */
static const unsigned char CALL_FUNCTION_VAR = 140;
enum COMPARE {
LESS = 0,
LESS_EQUAL,
EQUAL,
NOT_EQUAL,
GREATER,
GREATER_EQUAL,
IN,
NOT_IN,
IS,
IS_NOT,
EXC_MATCH
};
};
#endif
Loading...
Report
Report success
We will send you the feedback within 2 working days through the letter!
Please fill in the reason for the report carefully. Provide as detailed a description as possible.
Please select a report type
Cancel
Send
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

About

自己动手写Python虚拟机
No labels
LGPL-3.0
Use LGPL-3.0
Cancel

Releases

No release

Contributors

All

Activities

can not load any more
Edit
About
Homepage
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yjcf/pythonvm.git
git@gitee.com:yjcf/pythonvm.git
yjcf
pythonvm
pythonvm
master
Going to Help Center

Search

Comment
Repository Report
Back to the top
Login prompt
This operation requires login to the code cloud account. Please log in before operating.
Go to login
No account. Register

AltStyle によって変換されたページ (->オリジナル) /