From 82ecd61f5c699cf3af6c4eadf47a1c52b1d696c6 Mon Sep 17 00:00:00 2001 From: Aspen Smith Date: Sun, 11 Feb 2024 22:00:40 -0500 Subject: chore(users): grfn -> aspen Change-Id: I6c6847fac56f0a9a1a2209792e00a3aec5e672b9 Reviewed-on: https://cl.tvl.fyi/c/depot/+/10809 Autosubmit: aspen Reviewed-by: sterni Tested-by: BuildkiteCI Reviewed-by: lukegb --- users/aspen/achilles/ach/.gitignore | 7 +++++++ users/aspen/achilles/ach/Makefile | 15 +++++++++++++++ users/aspen/achilles/ach/externs.ach | 5 +++++ users/aspen/achilles/ach/functions.ach | 8 ++++++++ users/aspen/achilles/ach/simple.ach | 1 + users/aspen/achilles/ach/units.ach | 7 +++++++ 6 files changed, 43 insertions(+) create mode 100644 users/aspen/achilles/ach/.gitignore create mode 100644 users/aspen/achilles/ach/Makefile create mode 100644 users/aspen/achilles/ach/externs.ach create mode 100644 users/aspen/achilles/ach/functions.ach create mode 100644 users/aspen/achilles/ach/simple.ach create mode 100644 users/aspen/achilles/ach/units.ach (limited to 'users/aspen/achilles/ach') diff --git a/users/aspen/achilles/ach/.gitignore b/users/aspen/achilles/ach/.gitignore new file mode 100644 index 000000000000..ac5296ebbd74 --- /dev/null +++ b/users/aspen/achilles/ach/.gitignore @@ -0,0 +1,7 @@ +*.ll +*.o + +functions +simple +externs +units diff --git a/users/aspen/achilles/ach/Makefile b/users/aspen/achilles/ach/Makefile new file mode 100644 index 000000000000..3a8cd2865e87 --- /dev/null +++ b/users/aspen/achilles/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 functions diff --git a/users/aspen/achilles/ach/externs.ach b/users/aspen/achilles/ach/externs.ach new file mode 100644 index 000000000000..faf8ce90e353 --- /dev/null +++ b/users/aspen/achilles/ach/externs.ach @@ -0,0 +1,5 @@ +extern puts : fn cstring -> int + +fn main = + let _ = puts "foobar" + in 0 diff --git a/users/aspen/achilles/ach/functions.ach b/users/aspen/achilles/ach/functions.ach new file mode 100644 index 000000000000..dc6e7a1f3e34 --- /dev/null +++ b/users/aspen/achilles/ach/functions.ach @@ -0,0 +1,8 @@ +ty id : fn a -> a +fn id x = x + +ty plus : fn int -> int +fn plus (x: int) (y: int) = x + y + +ty main : fn -> int +fn main = plus (id 2) 7 diff --git a/users/aspen/achilles/ach/simple.ach b/users/aspen/achilles/ach/simple.ach new file mode 100644 index 000000000000..20f1677235c0 --- /dev/null +++ b/users/aspen/achilles/ach/simple.ach @@ -0,0 +1 @@ +fn main = let x = 2; y = 3 in x + y diff --git a/users/aspen/achilles/ach/units.ach b/users/aspen/achilles/ach/units.ach new file mode 100644 index 000000000000..70635d978c7c --- /dev/null +++ b/users/aspen/achilles/ach/units.ach @@ -0,0 +1,7 @@ +extern puts : fn cstring -> int + +ty print : fn cstring -> () +fn print x = let _ = puts x in () + +ty main : fn -> int +fn main = let _ = print "hi" in 0 -- cgit 1.4.1