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

21
06/error.hpp Normal file
View File

@@ -0,0 +1,21 @@
#pragma once
#include <exception>
#include "type.hpp"
struct type_error : std::exception {
std::string description;
type_error(std::string d)
: description(std::move(d)) {}
const char* what() const noexcept override;
};
struct unification_error : public type_error {
type_ptr left;
type_ptr right;
unification_error(type_ptr l, type_ptr r)
: left(std::move(l)), right(std::move(r)),
type_error("failed to unify types") {}
};