roza/lib/Compiler.hpp

38 lines
886 B
C++
Raw Normal View History

2023-08-30 18:06:26 +00:00
#ifndef roza_COMPILER_HPP
#define roza_COMPILER_HPP
#include "commons.hpp"
#include "Program.hpp"
#include "Node.hpp"
#include "opcodes.hpp"
#include "StatusLog.hpp"
#include "SymTable.hpp"
2023-09-01 20:38:12 +00:00
#include "Fun.hpp"
2023-08-30 18:06:26 +00:00
namespace roza
{
class Compiler
{
public:
explicit Compiler(StatusLog& log);
virtual ~Compiler();
2023-09-01 20:38:12 +00:00
std::shared_ptr<Program> compile(std::shared_ptr<Node> root,
std::shared_ptr<SymTable> sym);
void compile_node(std::shared_ptr<Node> root,
std::shared_ptr<Program> prog,
std::shared_ptr<SymTable> sym);
void compile_children(std::shared_ptr<Node> root,
std::shared_ptr<Program> prog,
std::shared_ptr<SymTable> sym);
2023-08-30 18:06:26 +00:00
private:
StatusLog& m_log;
2023-09-01 20:38:12 +00:00
std::vector<std::shared_ptr<Fun>> m_fun_stack;
2023-08-30 18:06:26 +00:00
};
}
#endif