aboutsummaryrefslogtreecommitdiff
path: root/include/symbol.hpp
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-03-10 15:14:01 +0000
committerCori Barker <coribarker2@gmail.com>2026-03-10 15:14:01 +0000
commitca44ea33919127b66b3ea9f8714ff0c30be61fee (patch)
tree2a9dc6bf563caebd15fb915a26e9b64b70799950 /include/symbol.hpp
parent85918e5c3ef2f109583c7f414e7d604df0272c03 (diff)
refactored symbol and symbol_table
Diffstat (limited to 'include/symbol.hpp')
-rw-r--r--include/symbol.hpp22
1 files changed, 17 insertions, 5 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
};