aboutsummaryrefslogtreecommitdiff
path: root/include/symbol.hpp
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-03-07 17:46:38 +0000
committerCori Barker <coribarker2@gmail.com>2026-03-07 17:46:38 +0000
commit6761fdd434a7e54551fe28398361f9eed5268406 (patch)
tree43f752cc165f6c13b1204dd0e82a219c0d2df4c3 /include/symbol.hpp
parent32ee1c8be581e1967950e125551d672ff65cb04b (diff)
code is a complete mess, simplified some classes as they are way too complex will expand in future but too complicated for now since its the first version.
Diffstat (limited to 'include/symbol.hpp')
-rw-r--r--include/symbol.hpp37
1 files changed, 6 insertions, 31 deletions
diff --git a/include/symbol.hpp b/include/symbol.hpp
index 4bee45d..c3c7ef4 100644
--- a/include/symbol.hpp
+++ b/include/symbol.hpp
@@ -1,38 +1,13 @@
#pragma once
-#include <string>
-#include <vector>
-
-#include "symbol_type.hpp"
-
class Symbol {
public:
- explicit Symbol(std::string name, SymbolType type, std::string data_type, int scope_level);
- std::string getName();
- SymbolType getSymbolType();
- std::string getDataType();
- int getScopeLevel();
- bool isInitialized();
- void setInitialized(bool init);
- bool isParameter();
- void setParameter(bool is_param);
- std::vector<std::string> getParameterTypes();
- void setParameterTypes(std::vector<std::string> types);
- std::string getReturnType();
- void setReturnType(std::string type);
- int getLineDeclared();
- void setLineDeclared(int line);
- std::string toString();
+ explicit Symbol();
private:
- std::string symbol_name;
- SymbolType symbol_type;
- std::string data_type;
- int scope_level;
- bool is_initialized;
- bool is_parameter;
- std::vector<std::string> parameter_types;
- std::string return_type;
- int line_declared;
- int column_declared;
+ std::string identifier;
+ Type type;
+ std::variant<int, bool, std::string> value;
};
+
+Symbol::Symbol(std::string identifier, Type type, std::variant<int, bool, std::string> value) : identifier(identifier), type(type), value(value) { }