aboutsummaryrefslogtreecommitdiff
path: root/include/semantic
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-02-09 11:05:11 +0000
committerCori Barker <coribarker2@gmail.com>2026-02-09 11:05:11 +0000
commita7b36237d7c703c96b6a22c11cf37045d999fcc6 (patch)
tree2f5fec8d71345e39285364e2695717cea4023b12 /include/semantic
parentddedc416185954051ff2a826c24fc1cc608204f1 (diff)
Written some class declarations
Diffstat (limited to 'include/semantic')
-rw-r--r--include/semantic/scope.h10
-rw-r--r--include/semantic/symbol.h24
2 files changed, 17 insertions, 17 deletions
diff --git a/include/semantic/scope.h b/include/semantic/scope.h
index aa13fe3..ff20542 100644
--- a/include/semantic/scope.h
+++ b/include/semantic/scope.h
@@ -5,12 +5,12 @@
class Scope {
public:
- explicit Scope(std::string name, int level, std::unique_ptr<Scope> parent);
+ explicit Scope(std::string name, int level, *Scope parent);
std::string getScopeName();
int getScopeLevel();
- std::unique_ptr<Scope> getParentScope();
+ *Scope getParentScope();
void define(Symbol symbol);
- std::unique_ptr<Symbol> lookup(std::string name);
+ *Symbol lookup(std::string name);
bool isDeclared(std::string name);
std::unordered_map<std::string, Symbol> getAllSymbols();
std::string toString();
@@ -18,6 +18,6 @@ public:
private:
std::string scope_name;
int scope_level
- std::unique_ptr<Scope> parent_scope;
- std::unordered_map<std::string, Symbol>;
+ *Scope parent_scope;
+ std::unordered_map<std::string, Symbol> symbols;
};
diff --git a/include/semantic/symbol.h b/include/semantic/symbol.h
index 3cb4290..94fe918 100644
--- a/include/semantic/symbol.h
+++ b/include/semantic/symbol.h
@@ -3,11 +3,11 @@
#include <string>
#include <vector>
-#include "types.h"
+#include "symbol_type.h"
class Symbol {
public:
- explicit Symbol(std::string name, SymbolType type, std::string data_type, int scope);
+ explicit Symbol(std::string name, SymbolType type, std::string data_type, int scope_level);
std::string getName();
SymbolType getSymbolType();
std::string getDataType();
@@ -25,14 +25,14 @@ public:
std::string toString();
private:
- std::string 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 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;
};