c-compiler/src/typechecker.h

29 lines
629 B
C++

#ifndef TYPECHECK_H
#define TYPECHECK_H
#include <map>
#include "types.h"
#include "errors.h"
namespace typecheck {
enum class TypecheckResult {
/// @brief The types match perfectly (enough)
Ok,
/// @brief The original type can be implicitly cast into the given type
Castable,
/// @brief The types are totally incompatible
Error,
};
struct Scope {
std::map<std::string, std::shared_ptr<types::Type>> symbols;
std::optional<std::shared_ptr<types::Type>> return_ty;
};
struct State {
std::vector<CompileError> errors;
};
}
#endif