grino/src/Module.hpp

40 lines
960 B
C++
Raw Permalink Normal View History

2023-09-13 19:11:36 +00:00
#ifndef grino_MODULE_HPP
#define grino_MODULE_HPP
#include "commons.hpp"
#include "Program.hpp"
#include "SymTable.hpp"
#include "VM.hpp"
#include "Loader.hpp"
2023-09-13 19:11:36 +00:00
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; }
2023-09-13 19:11:36 +00:00
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;
2023-09-13 19:11:36 +00:00
};
}
#endif