From ca44ea33919127b66b3ea9f8714ff0c30be61fee Mon Sep 17 00:00:00 2001 From: Cori Barker Date: Tue, 10 Mar 2026 15:14:01 +0000 Subject: refactored symbol and symbol_table --- include/symbol.hpp | 22 +++++++++++++++++----- include/symbol_table.hpp | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/include/symbol.hpp b/include/symbol.hpp index a388f04..d7be206 100644 --- a/include/symbol.hpp +++ b/include/symbol.hpp @@ -4,15 +4,27 @@ #include "type.hpp" #include +#include #include class Symbol { public: - explicit Symbol(); - -private: std::string identifier; + int line; + int column; + + virtual ~Symbol() = default; +}; + +class FunctionDeclarationSymbol : public Symbol { + Type return_type; + std::vector parameters; + + FunctionDeclarationSymbol(std::string identifier, Type return_type, std::vector parameters, int line, int column) : identifier(identifier), return_type(return_type), parameters(parameters), line(line), column(column) { } +}; + +class VariableDeclarationSymbol : public Symbol { + Type type; - SymbolType symbol_type; - std::variant value; + VariableDeclarationSymbol }; diff --git a/include/symbol_table.hpp b/include/symbol_table.hpp index 42c6cd7..e05ba4c 100644 --- a/include/symbol_table.hpp +++ b/include/symbol_table.hpp @@ -4,7 +4,7 @@ #include -class SymbolTable { +lass SymbolTable { public: explicit SymbolTable(); void addScope(Scope* scope); -- cgit v1.2.3