Continue implementation of compilation

This commit is contained in:
2019-10-01 23:23:52 -07:00
parent 9ca56f51ae
commit f49c045516
7 changed files with 94 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ struct env {
virtual ~env() = default;
virtual int get_offset(const std::string& name) const = 0;
virtual bool has_variable(const std::string& name) const = 0;
};
using env_ptr = std::shared_ptr<env>;
@@ -17,7 +18,8 @@ struct env_var {
env_var(std::string& n, env_ptr p)
: name(std::move(n)), parent(std::move(p)) {}
virtual int get_offset(const std::string& name) const;
int get_offset(const std::string& name) const;
bool has_variable(const std::string& name) const;
};
struct env_offset {
@@ -27,5 +29,6 @@ struct env_offset {
env_offset(int o, env_ptr p)
: offset(o), parent(std::move(p)) {}
virtual int get_offset(const std::string& name) const;
int get_offset(const std::string& name) const;
bool has_variable(const std::string& name) const;
};