about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-06-15 22:41:38 -0700
committerKartik Agaram <vc@akkartik.com>2020-06-15 22:41:38 -0700
commit9f0e69f19b462f2d9cbff784790e8b411e427492 (patch)
treeb59dffc7794b3e4efafbdc8ef7765331ed4533cc /apps
parent705dfd8587fab7d850163a3bbbca5075724ad946 (diff)
downloadmu-9f0e69f19b462f2d9cbff784790e8b411e427492.tar.gz
6535
Diffstat (limited to 'apps')
-rw-r--r--apps/arith.mu72
1 files changed, 36 insertions, 36 deletions
diff --git a/apps/arith.mu b/apps/arith.mu
index 2f41c5cd..4eef6127 100644
--- a/apps/arith.mu
+++ b/apps/arith.mu
@@ -20,44 +20,44 @@ fn main -> exit-status/ebx: int {
 }
 
 fn simplify -> result/eax: int, look/esi: byte {
-$simplify:body: {
-  look <- get-char  # prime the pump
-  # first arg
-  look <- skip-spaces look
-  {
+  $simplify:body: {
+    look <- get-char  # prime the pump
+    # first arg
+    look <- skip-spaces look
     {
-      var is-digit?/eax: boolean <- is-decimal-digit? look
-      compare is-digit?, 0  # false
-      break-if-= $simplify:body
+      {
+        var is-digit?/eax: boolean <- is-decimal-digit? look
+        compare is-digit?, 0  # false
+        break-if-= $simplify:body
+      }
+      result, look <- num look
     }
-    result, look <- num look
-  }
-  # operator
-  var op/ecx: byte <- copy 0
-  look <- skip-spaces look
-  op, look <- operator look
-  # second arg
-  var second/edx: int <- copy 0
-  look <- skip-spaces look
-  {
-    var tmp/eax: int <- copy 0
-    tmp, look <- num look
-    second <- copy tmp
-  }
-  # perform op
-  {
-    compare op, 0x2b  # '+'
-    break-if-!=
-    result <- add second
-    break $simplify:body
-  }
-  {
-    compare op, 0x2d  # '-'
-    break-if-!=
-    result <- subtract second
-    break $simplify:body
-  }
-}  # $simplify:body
+    # operator
+    var op/ecx: byte <- copy 0
+    look <- skip-spaces look
+    op, look <- operator look
+    # second arg
+    var second/edx: int <- copy 0
+    look <- skip-spaces look
+    {
+      var tmp/eax: int <- copy 0
+      tmp, look <- num look
+      second <- copy tmp
+    }
+    # perform op
+    {
+      compare op, 0x2b  # '+'
+      break-if-!=
+      result <- add second
+      break $simplify:body
+    }
+    {
+      compare op, 0x2d  # '-'
+      break-if-!=
+      result <- subtract second
+      break $simplify:body
+    }
+  }  # $simplify:body
   # trailing spaces
   look <- skip-spaces look
 }