c-compiler/src/typechecker.h

32 lines
749 B
C++

#ifndef TYPECHECK_H
#define TYPECHECK_H
#include <map>
#include "types.h"
#include "binops.h"
#include "casting.h"
#include "errors.h"
namespace typecheck {
struct Scope {
std::map<std::string, std::shared_ptr<types::Type>> symbols;
std::map<std::string, std::shared_ptr<types::Type>> structs;
std::optional<std::shared_ptr<types::Type>> return_ty;
};
struct State {
std::vector<types::BinopDefinition> binops;
std::vector<types::UnopDefinition> unops;
std::vector<types::CastDefinition> casts;
std::vector<CompileError> errors;
};
struct ExpressionType {
std::shared_ptr<types::Type> type;
bool array_initializer;
bool lvalue;
};
}
#endif