40 lines
960 B
C++
40 lines
960 B
C++
#ifndef grino_MODULE_HPP
|
|
#define grino_MODULE_HPP
|
|
|
|
#include "commons.hpp"
|
|
#include "Program.hpp"
|
|
#include "SymTable.hpp"
|
|
#include "VM.hpp"
|
|
#include "Loader.hpp"
|
|
|
|
namespace grino
|
|
{
|
|
class Module
|
|
{
|
|
public:
|
|
explicit Module(std::filesystem::path path, std::string const& name="");
|
|
virtual ~Module();
|
|
|
|
std::string name() const { return m_name; }
|
|
void load();
|
|
void load_native();
|
|
std::shared_ptr<SymTable> sym_table() const { return m_sym_table; }
|
|
std::shared_ptr<Loader> loader() const { return m_loader; }
|
|
std::shared_ptr<Value> find(std::string const& name);
|
|
std::shared_ptr<Value> from_heap(size_t addr);
|
|
|
|
private:
|
|
std::filesystem::path m_path;
|
|
std::string m_name;
|
|
Logger m_logger;
|
|
std::shared_ptr<Program> m_program;
|
|
std::shared_ptr<SymTable> m_sym_table;
|
|
std::shared_ptr<VM> m_vm;
|
|
Addr m_addr;
|
|
std::shared_ptr<Compiler> m_compiler;
|
|
std::shared_ptr<Loader> m_loader;
|
|
};
|
|
}
|
|
|
|
#endif
|