forked from PuqiAR/Fig-TreeWalker
[Fix] 修复科学表达式数字解析的问题(Lexer引起) 由 Satklomi发现,感谢 [Feat] 增加Compiler相关定义,将开发BytecodeVM [Tip] Evaluator进入Bug fix阶段,新功能延缓开发。转向VM
43 lines
3.9 KiB
C++
43 lines
3.9 KiB
C++
/*
|
|
|
|
███████████ █████ █████ ██████████ ███████████ █████ █████████ █████ █████████ ██████ █████ █████████ █████ █████ █████████ █████████ ██████████
|
|
░█░░░███░░░█░░███ ░░███ ░░███░░░░░█ ░░███░░░░░░█░░███ ███░░░░░███ ░░███ ███░░░░░███ ░░██████ ░░███ ███░░░░░███░░███ ░░███ ███░░░░░███ ███░░░░░███░░███░░░░░█
|
|
░ ░███ ░ ░███ ░███ ░███ █ ░ ░███ █ ░ ░███ ███ ░░░ ░███ ░███ ░███ ░███░███ ░███ ███ ░░░ ░███ ░███ ░███ ░███ ███ ░░░ ░███ █ ░
|
|
░███ ░███████████ ░██████ ░███████ ░███ ░███ ░███ ░███████████ ░███░░███░███ ░███ ░███ ░███ ░███████████ ░███ ░██████
|
|
░███ ░███░░░░░███ ░███░░█ ░███░░░█ ░███ ░███ █████ ░███ ░███░░░░░███ ░███ ░░██████ ░███ █████ ░███ ░███ ░███░░░░░███ ░███ █████ ░███░░█
|
|
░███ ░███ ░███ ░███ ░ █ ░███ ░ ░███ ░░███ ░░███ ░███ █ ░███ ░███ ░███ ░░█████ ░░███ ░░███ ░███ ░███ ░███ ░███ ░░███ ░░███ ░███ ░ █
|
|
█████ █████ █████ ██████████ █████ █████ ░░█████████ ███████████ █████ █████ █████ ░░█████ ░░█████████ ░░████████ █████ █████ ░░█████████ ██████████
|
|
░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░░░░░
|
|
|
|
Copyright (C) 2020-2026 PuqiAR
|
|
|
|
This software is licensed under the MIT License. See LICENSE for details.
|
|
*/
|
|
|
|
|
|
// DO NOT USE CLANG-FORMAT FOR THIS FILE
|
|
|
|
#include <Bytecode/Bytecode.hpp>
|
|
#include <iostream>
|
|
|
|
int main()
|
|
{
|
|
using namespace Fig;
|
|
|
|
|
|
std::vector<OpCodeType> src;
|
|
|
|
{
|
|
using enum Bytecode;
|
|
src = {
|
|
0x21, // LOAD_TRUE
|
|
0x23, 0x7f, // LOAD_CON8 0x7f
|
|
0x24, 0x12, 0x34, // LOAD_CON16 0x1234
|
|
0x25, 0x12, 0x34, 0x56, 0x78, // LOAD_CON32 0x12345678
|
|
0x63, 0x12, 0x34, 0x56, 0x78 // JUMP32_IF_TRUE
|
|
};
|
|
|
|
FString r = reverseCompile(src);
|
|
std::cout << r.toBasicString() << std::endl;
|
|
}
|
|
} |