Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / Value
diff options
context:
space:
mode:
Commit8f41c57ff12fa72693016b75fec63bb86ae6560f (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-01-18 11:51:57 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-01-18 11:51:57 +0200
Filesb308172d90c6d70fe8268a960a7a8ded8466d75d /Year 2/Implementation of Programming Languages/Transpiler/src/Value
uni-projects-8f41c57ff12fa72693016b75fec63bb86ae6560f.tar
uni-projects-8f41c57ff12fa72693016b75fec63bb86ae6560f.tar.gz
uni-projects-8f41c57ff12fa72693016b75fec63bb86ae6560f.zip
Parentefbc9d2a15ac6d21caf9cb87e7e913e35f48e391 (diff)
[IPL/T] Implemented initial structure with Integer data type
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.cpp b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.cpp
new file mode 100644
index 0000000..d7f70e3
--- /dev/null
+++ b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.cpp
@@ -0,0 +1,12 @@
+#include "Integer.h"
+#include "../LLVMVisitor/LLVMVisitor.h"
+
+std::string Integer::Visit(LLVMVisitor& visitor) const {
+ return visitor.Visit(*this);
+}
+
+const int& Integer::get_value() const {
+ return this->value;
+}
+
+Integer::Integer(int value) : value(value) {}
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.h b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.h
new file mode 100644
index 0000000..3859d1d
--- /dev/null
+++ b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Integer.h
@@ -0,0 +1,16 @@
+#ifndef VALUE_INTEGER
+#define VALUE_INTEGER
+
+#include "Value.h"
+
+class Integer : public Value {
+ int value;
+public:
+ std::string Visit(LLVMVisitor& visitor) const override;
+ const int& get_value() const;
+
+ Integer(int value);
+ ~Integer() override = default;
+};
+
+#endif
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Value.h b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Value.h
new file mode 100644
index 0000000..8488262
--- /dev/null
+++ b/Year 2/Implementation of Programming Languages/Transpiler/src/Value/Value.h
@@ -0,0 +1,14 @@
+#ifndef VALUE
+#define VALUE
+
+#include <string>
+
+class LLVMVisitor;
+
+class Value {
+public:
+ virtual std::string Visit(LLVMVisitor& visitor) const = 0;
+ virtual ~Value() {};
+};
+
+#endif