From 4d359b9c16b01847b26d6827e137f680c65969f2 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Tue, 7 Feb 2023 20:06:31 +0200 Subject: [IPL/T] Overhauled how functions are handled, added list type --- .../Transpiler/src/main.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'Year 2/Implementation of Programming Languages/Transpiler/src/main.cpp') 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 #include #include "LLVMVisitor/LLVMVisitor.h" -#include "Value/Function/BuiltInFunction.h" +#include "Value/Function/Funcall.h" int main() { LLVMVisitor visitor("testout.ll"); std::deque 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(); } -- cgit v1.3.1-23-gd82d