#ifndef roza_SYMTABLE_HPP #define roza_SYMTABLE_HPP #include "commons.hpp" #include "Node.hpp" namespace roza { struct SymEntry { int addr; int scope; std::shared_ptr node; bool is_mut; }; class SymTable { public: explicit SymTable(); explicit SymTable(SymTable const& sym_table); virtual ~SymTable(); int declare(std::string const& name, std::shared_ptr node); int declare_mut(std::string const& name, std::shared_ptr node); SymEntry& find(std::string const& name); SymEntry const& find(std::string const& name) const; bool exists(std::string const& name) const; private: static int addr; std::unordered_map m_entries; int m_scope = 0; }; } #endif