aboutsummaryrefslogtreecommitdiff
path: root/include/semantic/scope.h
diff options
context:
space:
mode:
authorCori Barker <coribarker2@gmail.com>2026-02-05 09:32:20 +0000
committerCori Barker <coribarker2@gmail.com>2026-02-05 09:32:20 +0000
commitddedc416185954051ff2a826c24fc1cc608204f1 (patch)
tree4dca1a13fc43ab9eb8c415aa116c02c8c543d074 /include/semantic/scope.h
parent44eb8234648bfd6c4607d4fd0d804bbfb9168589 (diff)
Written some class declarations for the semantics, updated README
Diffstat (limited to 'include/semantic/scope.h')
-rw-r--r--include/semantic/scope.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/semantic/scope.h b/include/semantic/scope.h
new file mode 100644
index 0000000..aa13fe3
--- /dev/null
+++ b/include/semantic/scope.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <string>
+#include <memory>
+
+class Scope {
+public:
+ explicit Scope(std::string name, int level, std::unique_ptr<Scope> parent);
+ std::string getScopeName();
+ int getScopeLevel();
+ std::unique_ptr<Scope> getParentScope();
+ void define(Symbol symbol);
+ std::unique_ptr<Symbol> lookup(std::string name);
+ bool isDeclared(std::string name);
+ std::unordered_map<std::string, Symbol> getAllSymbols();
+ std::string toString();
+
+private:
+ std::string scope_name;
+ int scope_level
+ std::unique_ptr<Scope> parent_scope;
+ std::unordered_map<std::string, Symbol>;
+};