about summary refs log tree commit diff stats
path: root/linux/ex2.mu
diff options
context:
space:
mode:
Diffstat (limited to 'linux/ex2.mu')
-rw-r--r--linux/ex2.mu19
1 files changed, 19 insertions, 0 deletions
diff --git a/linux/ex2.mu b/linux/ex2.mu
new file mode 100644
index 00000000..16f04d29
--- /dev/null
+++ b/linux/ex2.mu
@@ -0,0 +1,19 @@
+# Add 3 and 4, and return the result in the exit code.
+#
+# To run:
+#   $ ./translate_mu apps/ex2.mu
+#   $ ./a.elf
+# Expected result:
+#   $ echo $?
+#   7
+
+fn main -> _/ebx: int {
+  var result/eax: int <- do-add 3 4
+  return result
+}
+
+fn do-add a: int, b: int -> _/eax: int {
+  var result/ecx: int <- copy a
+  result <- add b
+  return result
+}