aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/symbol.hpp22
-rw-r--r--include/symbol_table.hpp2
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);