forked from PuqiAR/Fig-TreeWalker
[Fix] 修复科学表达式数字解析的问题(Lexer引起) 由 Satklomi发现,感谢 [Feat] 增加Compiler相关定义,将开发BytecodeVM [Tip] Evaluator进入Bug fix阶段,新功能延缓开发。转向VM
32 lines
753 B
C++
32 lines
753 B
C++
#pragma once
|
|
|
|
#include "Ast/astBase.hpp"
|
|
#include <Ast/ast.hpp>
|
|
#include <Bytecode/Bytecode.hpp>
|
|
#include <VMValue/VMValue.hpp>
|
|
|
|
#include <vector>
|
|
|
|
namespace Fig
|
|
{
|
|
class Compiler
|
|
{
|
|
private:
|
|
std::vector<Ast::Statement> source;
|
|
std::vector<OpCodeType> output; // std::vector<uint8_t>
|
|
|
|
std::vector<Value> constants;
|
|
public:
|
|
std::vector<OpCodeType> getOutput() const { return output; }
|
|
std::vector<Value> getConstantPool() const { return constants; }
|
|
|
|
Compiler() {}
|
|
Compiler(std::vector<Ast::Statement> _source) : source(std::move(_source)) {}
|
|
|
|
void compile_expr(Ast::Expression);
|
|
|
|
void compile(Ast::Statement);
|
|
|
|
void CompileAll();
|
|
};
|
|
}; // namespace Fig
|