From 32d5099fa005bdeed30bd1e6798b81e3a75f1a1a Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 2 Mar 2020 08:20:53 -0800 Subject: 6077 --- html/apps/ex1.mu.html | 4 +- html/apps/ex2.2.mu.html | 4 +- html/apps/ex2.mu.html | 4 +- html/apps/ex3.mu.html | 8 ++-- html/apps/factorial.mu.html | 89 +++++++++++++++++++++++---------------------- 5 files changed, 55 insertions(+), 54 deletions(-) (limited to 'html/apps') diff --git a/html/apps/ex1.mu.html b/html/apps/ex1.mu.html index b6b86a75..1e1139ae 100644 --- a/html/apps/ex1.mu.html +++ b/html/apps/ex1.mu.html @@ -65,8 +65,8 @@ if ('onhashchange' in window) { 8 # $ echo $? 9 # 42 10 -11 fn main -> result/ebx: int { -12 result <- copy 0x2a # Mu requires hexadecimal +11 fn main -> result/ebx: int { +12 result <- copy 0x2a # Mu requires hexadecimal 13 } diff --git a/html/apps/ex2.2.mu.html b/html/apps/ex2.2.mu.html index 4cab5df4..dd193373 100644 --- a/html/apps/ex2.2.mu.html +++ b/html/apps/ex2.2.mu.html @@ -54,13 +54,13 @@ if ('onhashchange' in window) { https://github.com/akkartik/mu/blob/master/apps/ex2.2.mu
- 1 fn main -> result/ebx: int {
+ 1 fn main -> result/ebx: int {
  2   result <- foo
  3 }
  4 
  5 fn foo -> result/ebx: int {
  6   var n: int
- 7   copy-to n, 3
+ 7   copy-to n, 3
  8   increment n
  9   result <- copy n
 10 }
diff --git a/html/apps/ex2.mu.html b/html/apps/ex2.mu.html
index 385dc271..e6c0be2f 100644
--- a/html/apps/ex2.mu.html
+++ b/html/apps/ex2.mu.html
@@ -64,8 +64,8 @@ if ('onhashchange' in window) {
  7 #   $ echo $?
  8 #   7
  9 
-10 fn main -> result/ebx: int {
-11   result <- do-add 3 4
+10 fn main -> result/ebx: int {
+11   result <- do-add 3 4
 12 }
 13 
 14 fn do-add a: int, b: int -> result/ebx: int {
diff --git a/html/apps/ex3.mu.html b/html/apps/ex3.mu.html
index bae8125a..60aac512 100644
--- a/html/apps/ex3.mu.html
+++ b/html/apps/ex3.mu.html
@@ -55,11 +55,11 @@ if ('onhashchange' in window) {
 
 https://github.com/akkartik/mu/blob/master/apps/ex3.mu
 
- 1 fn main -> result/ebx: int {
- 2   result <- copy 0
- 3   var i/eax: int <- copy 1
+ 1 fn main -> result/ebx: int {
+ 2   result <- copy 0
+ 3   var i/eax: int <- copy 1
  4   {
- 5     compare i, 0xa
+ 5     compare i, 0xa
  6     break-if->
  7     result <- add i
  8     i <- increment
diff --git a/html/apps/factorial.mu.html b/html/apps/factorial.mu.html
index f953f504..d5afe896 100644
--- a/html/apps/factorial.mu.html
+++ b/html/apps/factorial.mu.html
@@ -60,50 +60,51 @@ if ('onhashchange' in window) {
  2 #   ./translate_mu apps/factorial.mu
  3 #   ./a.elf test  # to run tests
  4 #   ./a.elf       # to run factorial(5)
- 5 fn main args: (addr array kernel-string) -> exit-status/ebx: int {
- 6   var a/eax: (addr array kernel-string) <- copy args
- 7   var tmp/ecx: int <- length a
- 8   $main-body: {
- 9     compare tmp, 1
-10     # if (len(args) == 1) factorial(5)
-11     {
-12       break-if-!=
-13       var tmp/eax: int <- factorial 5
-14       exit-status <- copy tmp
-15       break $main-body
-16     }
-17     # if (args[1] == "test") run-tests()
-18     var tmp2/ecx: int <- copy 1  # we need this just because we don't yet support `index` on literals; requires some translation-time computation
-19     var tmp3/ecx: (addr kernel-string) <- index a, tmp2
-20     var tmp4/eax: boolean <- kernel-string-equal? *tmp3, "test"
-21     compare tmp4, 0
-22     {
-23       break-if-=
-24       run-tests
-25       exit-status <- copy 0  # TODO: get at Num-test-failures somehow
-26     }
-27   }
-28 }
-29 
-30 fn factorial n: int -> result/eax: int {
-31   compare n 1
-32   {
-33     break-if->
-34     result <- copy 1
-35   }
-36   {
-37     break-if-<=
-38     var tmp/ecx: int <- copy n
-39     tmp <- decrement
-40     result <- factorial tmp
-41     result <- multiply n
-42   }
-43 }
-44 
-45 fn test-factorial {
-46   var result/eax: int <- factorial 5
-47   check-ints-equal result 0x78 "F - test-factorial"
-48 }
+ 5 
+ 6 fn factorial n: int -> result/eax: int {
+ 7   compare n 1
+ 8   {
+ 9     break-if->
+10     result <- copy 1
+11   }
+12   {
+13     break-if-<=
+14     var tmp/ecx: int <- copy n
+15     tmp <- decrement
+16     result <- factorial tmp
+17     result <- multiply n
+18   }
+19 }
+20 
+21 fn test-factorial {
+22   var result/eax: int <- factorial 5
+23   check-ints-equal result 0x78 "F - test-factorial"
+24 }
+25 
+26 fn main args: (addr array kernel-string) -> exit-status/ebx: int {
+27   var a/eax: (addr array kernel-string) <- copy args
+28   var tmp/ecx: int <- length a
+29   $main-body: {
+30     compare tmp, 1
+31     # if (len(args) == 1) factorial(5)
+32     {
+33       break-if-!=
+34       var tmp/eax: int <- factorial 5
+35       exit-status <- copy tmp
+36       break $main-body
+37     }
+38     # if (args[1] == "test") run-tests()
+39     var tmp2/ecx: int <- copy 1  # we need this just because we don't yet support `index` on literals; requires some translation-time computation
+40     var tmp3/ecx: (addr kernel-string) <- index a, tmp2
+41     var tmp4/eax: boolean <- kernel-string-equal? *tmp3, "test"
+42     compare tmp4, 0
+43     {
+44       break-if-=
+45       run-tests
+46       exit-status <- copy 0  # TODO: get at Num-test-failures somehow
+47     }
+48   }
+49 }
 
-- cgit 1.4.1-2-gfad0