inital commit
This commit is contained in:
1 parent
e9773c9161
commit
e8b8565773
36 files changed
+40468
No files matched your search
@@ -0,0 +1,41 @@
|
||||
#ifndef DLANG_COMPILER_HPP
|
||||
#define DLANG_COMPILER_HPP
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "types/include.hpp"
|
||||
#include "program.hpp"
|
||||
|
||||
#include "parser/expressions.hpp"
|
||||
#include "parser/statements.hpp"
|
||||
|
||||
class Compiler
|
||||
{
|
||||
private:
|
||||
std::vector<double> _bytecode;
|
||||
std::vector<std::string> _stringTable;
|
||||
std::vector<std::string> _includes;
|
||||
Program* _program = nullptr;
|
||||
|
||||
private:
|
||||
void Emit(Opcodes op);
|
||||
void Emit(const std::string& str);
|
||||
void Emit(double value);
|
||||
|
||||
void Compile(Statement* stmt);
|
||||
void Compile(Expression* expr);
|
||||
|
||||
void FinalCompile();
|
||||
|
||||
public:
|
||||
Compiler(Program* program);
|
||||
|
||||
void Compile();
|
||||
const std::vector<double>& GetBytecode() const;
|
||||
|
||||
void Print();
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user