From 78357b8852626b510527f3b8d770a7dd8956fcc7 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Fri, 16 Jul 2021 08:38:43 -0700 Subject: . --- html/linux/apps/ex2.mu.html | 83 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 html/linux/apps/ex2.mu.html (limited to 'html/linux/apps/ex2.mu.html') diff --git a/html/linux/apps/ex2.mu.html b/html/linux/apps/ex2.mu.html new file mode 100644 index 00000000..48ee0e00 --- /dev/null +++ b/html/linux/apps/ex2.mu.html @@ -0,0 +1,83 @@ + + + + +Mu - linux/apps/ex2.mu + + + + + + + + + + +https://github.com/akkartik/mu/blob/main/linux/apps/ex2.mu +
+ 1 # Add 3 and 4, and return the result in the exit code.
+ 2 #
+ 3 # To run:
+ 4 #   $ ./translate apps/ex2.mu
+ 5 #   $ ./a.elf
+ 6 # Expected result:
+ 7 #   $ echo $?
+ 8 #   7
+ 9 
+10 fn main -> _/ebx: int {
+11   var result/eax: int <- do-add 3 4
+12   return result
+13 }
+14 
+15 fn do-add a: int, b: int -> _/eax: int {
+16   var result/ecx: int <- copy a
+17   result <- add b
+18   return result
+19 }
+
+ + + -- cgit 1.4.1-2-gfad0