Create new 'branch' for part 6 of compiler series

This commit is contained in:
2019-10-01 11:05:21 -07:00
parent b065d95804
commit ef86d60bda
19 changed files with 867 additions and 0 deletions

16
06/env.hpp Normal file
View File

@@ -0,0 +1,16 @@
#pragma once
#include <map>
#include "type.hpp"
struct type_env {
std::map<std::string, type_ptr> names;
type_env const* parent = nullptr;
type_env(type_env const* p)
: parent(p) {}
type_env() : type_env(nullptr) {}
type_ptr lookup(const std::string& name) const;
void bind(const std::string& name, type_ptr t);
type_env scope() const;
};