From 80f8ede0bbc9799d5199707e1e1ad8e80e4ca7ac Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 7 Mar 2021 15:29:59 -0500 Subject: Initial commit --- ach/.gitignore | 2 ++ ach/Makefile | 15 +++++++++++++++ ach/functions.ach | 3 +++ ach/simple.ach | 1 + 4 files changed, 21 insertions(+) create mode 100644 ach/.gitignore create mode 100644 ach/Makefile create mode 100644 ach/functions.ach create mode 100644 ach/simple.ach (limited to 'ach') diff --git a/ach/.gitignore b/ach/.gitignore new file mode 100644 index 000000000000..e8423ae351b8 --- /dev/null +++ b/ach/.gitignore @@ -0,0 +1,2 @@ +*.ll +*.o diff --git a/ach/Makefile b/ach/Makefile new file mode 100644 index 000000000000..869a0d0f8a3e --- /dev/null +++ b/ach/Makefile @@ -0,0 +1,15 @@ +default: simple + +%.ll: %.ach + cargo run -- compile $< -o $@ -f llvm + +%.o: %.ll + llc $< -o $@ -filetype=obj + +%: %.o + clang $< -o $@ + +.PHONY: clean + +clean: + @rm -f *.ll *.o simple diff --git a/ach/functions.ach b/ach/functions.ach new file mode 100644 index 000000000000..8d91564c1559 --- /dev/null +++ b/ach/functions.ach @@ -0,0 +1,3 @@ +fn id x = x +fn plus x y = x + y +fn main = plus (id 2) 7 diff --git a/ach/simple.ach b/ach/simple.ach new file mode 100644 index 000000000000..20f1677235c0 --- /dev/null +++ b/ach/simple.ach @@ -0,0 +1 @@ +fn main = let x = 2; y = 3 in x + y -- cgit 1.4.1