diff options
| author | Cori Barker <coribarker2@gmail.com> | 2026-03-10 15:14:01 +0000 |
|---|---|---|
| committer | Cori Barker <coribarker2@gmail.com> | 2026-03-10 15:14:01 +0000 |
| commit | ca44ea33919127b66b3ea9f8714ff0c30be61fee (patch) | |
| tree | 2a9dc6bf563caebd15fb915a26e9b64b70799950 /include | |
| parent | 85918e5c3ef2f109583c7f414e7d604df0272c03 (diff) | |
refactored symbol and symbol_table
Diffstat (limited to 'include')
| -rw-r--r-- | include/symbol.hpp | 22 | ||||
| -rw-r--r-- | 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 <variant> +#include <vector> #include <string> 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<std::string> parameters; + + FunctionDeclarationSymbol(std::string identifier, Type return_type, std::vector<std::string> 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<int, bool, std::string> 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 <vector> -class SymbolTable { +lass SymbolTable { public: explicit SymbolTable(); void addScope(Scope* scope); |
