write symbol check

This commit is contained in:
2024-08-13 08:28:21 +00:00
parent 4beb9585c5
commit a39625e4f2
7 changed files with 311 additions and 52 deletions

View File

@ -1,5 +1,6 @@
#pragma once
#include <stdexcept>
#include <variant>
enum class ASTNodeType {
// Expression nodes
NewArrayExpr,
@ -58,4 +59,12 @@ class SemanticError : public std::exception {
SemanticError(const std::string &msg, int error_code) : msg(msg), error_code(error_code) {}
const char *what() const noexcept override { return msg.c_str(); }
int GetErrorCode() const { return error_code; }
};
};
using IdentifierType = std::string;
struct ArrayType {
bool has_base_type;
IdentifierType basetype;
size_t level;
};
using ExprTypeInfo = std::variant<IdentifierType, ArrayType>;