Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / main.cpp
diff options
context:
space:
mode:
Commit4d359b9c16b01847b26d6827e137f680c65969f2 (patch)
Author
 Syndamia <kamen@syndamia.com>
2023-02-07 20:06:31 +0200
Committer
 Syndamia <kamen@syndamia.com>
2023-02-07 20:06:31 +0200
Files2af4cf7c92237f1a55550cd8866e8bcb0b51b87c /Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp
uni-projects-4d359b9c16b01847b26d6827e137f680c65969f2.tar
uni-projects-4d359b9c16b01847b26d6827e137f680c65969f2.tar.gz
uni-projects-4d359b9c16b01847b26d6827e137f680c65969f2.zip
Parent38c4a1355cb573d47c3e26f83ca8e916b62c80d1 (diff)
[IPL/T] Overhauled how functions are handled, added list type
1 files changed, 14 insertions, 5 deletions
-rw-r--r--Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp19
diff --git a/Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp b/Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp
index 7fc9bcf..319f408 100644
--- a/Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp
+++ b/Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp
@@ -1,18 +1,27 @@
#include <iostream>
#include <deque>
#include "LLVMVisitor/LLVMVisitor.h"
-#include "Value/Function/BuiltInFunction.h"
+#include "Value/Function/Funcall.h"
int main() {
LLVMVisitor visitor("testout.ll");
std::deque<Value*> nodes = {
- new BuiltInFunction("+", {
+ new Funcall("+", {
new Float(1),
+ new Funcall("-", { new Float(5), new Float(10) }),
new Float(2),
- new BuiltInFunction("-", { new Float(5), new Float(10) }),
- new Float(123) }) };
+ new Float(123) }),
+ new Funcall("defun", {
+ new Name("notfun"),
+ new List({new Name("a"), new Name("b")}),
+ new Funcall("+", {
+ new Integer(7),
+ new Name("a"),
+ new Name("b")
+ }) })
+ };
for (Value* n : nodes) {
n->Visit(visitor);
}
- visitor.finalizeFile();
+ visitor.insertMain();
}