Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / main.cpp
blob: 319f408e95b06831f94b5db834905264c4c67ecf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <deque>
#include "LLVMVisitor/LLVMVisitor.h"
#include "Value/Function/Funcall.h"

int main() {
	LLVMVisitor visitor("testout.ll");
	std::deque<Value*> nodes = {
		new Funcall("+", {
				new Float(1),
				new Funcall("-", { new Float(5), new Float(10) }),
				new Float(2),
				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.insertMain();
}