This repository has been archived on 2023-09-10. You can view files and clone it, but cannot push or open issues/pull-requests.
joko/lib/Loader.hpp

38 lines
895 B
C++
Raw Permalink Normal View History

2023-09-09 22:03:28 +00:00
#ifndef jk_LOADER_HPP
#define jk_LOADER_HPP
#include "commons.hpp"
#include "VM.hpp"
#include "SymTable.hpp"
#include "Function.hpp"
2023-09-10 14:16:20 +00:00
#include "StaticFunction.hpp"
#include "Compiler.hpp"
#include "StaticPass.hpp"
2023-09-09 22:03:28 +00:00
namespace jk
{
class Loader
{
public:
explicit Loader(std::shared_ptr<VM> vm,
2023-09-10 14:16:20 +00:00
std::shared_ptr<StaticPass> static_pass,
std::shared_ptr<Compiler> compiler,
2023-09-09 22:03:28 +00:00
std::shared_ptr<SymTable> sym);
virtual ~Loader();
2023-09-10 14:16:20 +00:00
std::shared_ptr<Compiler> compiler() const { return m_compiler; }
2023-09-09 22:03:28 +00:00
void load();
void declare(std::string const& name, foreign_t body);
2023-09-10 14:16:20 +00:00
void declare_static(std::string const& name, static_fun_t body);
2023-09-09 22:03:28 +00:00
private:
std::shared_ptr<VM> m_vm;
2023-09-10 14:16:20 +00:00
std::shared_ptr<StaticPass> m_static_pass;
std::shared_ptr<Compiler> m_compiler;
2023-09-09 22:03:28 +00:00
std::shared_ptr<SymTable> m_sym;
};
}
#endif