aboutsummaryrefslogtreecommitdiff
path: root/src/symbol.cpp
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-03-07 18:33:21 +0000
committerCori Barker <coribarker2@gmail.com>2026-03-07 18:33:21 +0000
commit50a51df0404ee4f057fbc19657672d1c7d3eef68 (patch)
tree9cb9ed4572a357448f2b78c4ac0add7eaf6a1e7e /src/symbol.cpp
parent6761fdd434a7e54551fe28398361f9eed5268406 (diff)
removed implementations of symbol table related classes, need to fix the parser to use the new AST node classes then i can write the symbol table classes and refactor the lexer and parser to use the symbol table
Diffstat (limited to 'src/symbol.cpp')
-rw-r--r--src/symbol.cpp126
1 files changed, 0 insertions, 126 deletions
diff --git a/src/symbol.cpp b/src/symbol.cpp
deleted file mode 100644
index ad2041d..0000000
--- a/src/symbol.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-#include "symbol.hpp"
-
-Symbol::Symbol(std::string name, SymbolType type, std::string data_type, int scope) : symbol_name(name), symbol_type(type), data_type(data_type), scope_level(scope_level) {}
-
-std::string Symbool::getName() {
- return name;
-}
-
-SymbolType Symbol::getSymbolType() {
- return symbol_type;
-}
-
-std::string Symbol::getDataType() {
- return symbol_data_type;
-}
-
-int Symbol::getSymbolLevel() {
- return scope_level;
-}
-
-bool Symbol::isInitialized() {
- return is_initialized;
-}
-
-void Symbol::setInitialized(bool init) {
- is_initialized = init;
-}
-
-bool Symbol::isParameter() {
- return is_parameter();
-}
-
-void Symbol::setParameter(bool is_param) {
- is_parameter = is_param;
-}
-
-std::vector<std::string> Symbol::getParameterTypes() {
- return paremeter_types;
-}
-
-void Symbol::setParameterTypes(std::vector<std::string> types) {
- parameter_types = types;
-}
-
-std::string Symbol::getReturnType() {
- return return_type;
-}
-
-void Symbol::setReturnType(std::string type) {
- return_type = type;
-}
-
-int Symbol::getLineDeclared() {
- return line_declared;
-}
-
-void Symbol::setLineDeclared(int line) {
- line_declared = line;
-}
-
-std::string Symbol::toString() const {
- std::string result = "";
-
- // Symbol name and basic info
- result += "Symbol: " + name + "\n";
-
- // Symbol type (VARIABLE, FUNCTION, PARAMETER)
- result += " Type: ";
- switch (symbol_type) {
- case SymbolType::VARIABLE:
- result += "VARIABLE\n";
- break;
- case SymbolType::FUNCTION:
- result += "FUNCTION\n";
- break;
- case SymbolType::PARAMETER:
- result += "PARAMETER\n";
- break;
- default:
- result += "UNKNOWN\n";
- break;
- }
-
- // Data type
- result += " Data Type: " + data_type + "\n";
-
- // Scope level
- result += " Scope Level: " + std::to_string(scope_level) + "\n";
-
- // Initialization status (only relevant for variables)
- if (symbol_type == SymbolType::VARIABLE || symbol_type == SymbolType::PARAMETER) {
- result += " Initialized: " + std::string(is_initialized ? "true" : "false") + "\n";
- }
-
- // Parameter flag
- if (is_parameter) {
- result += " Is Parameter: true\n";
- }
-
- // Function-specific information
- if (symbol_type == SymbolType::FUNCTION) {
- result += " Return Type: " + return_type + "\n";
-
- result += " Parameters: [";
- for (size_t i = 0; i < parameter_types.size(); i++) {
- result += parameter_types[i];
- if (i < parameter_types.size() - 1) {
- result += ", ";
- }
- }
- result += "]\n";
-
- result += " Parameter Count: " + std::to_string(parameter_types.size()) + "\n";
- }
-
- // Declaration location
- if (line_declared > 0) {
- result += " Declared at: line " + std::to_string(line_declared);
- if (column_declared > 0) {
- result += ", column " + std::to_string(column_declared);
- }
- result += "\n";
- }
-
- return result;
-}