From 2655a4a91d1d2e98cc9ab9c54e70d4eb49c735d6 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 30 Jun 2020 14:54:30 -0700 Subject: 6602 --- html/apps/arith.mu.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'html/apps/arith.mu.html') diff --git a/html/apps/arith.mu.html b/html/apps/arith.mu.html index 64db9a11..7d2e2234 100644 --- a/html/apps/arith.mu.html +++ b/html/apps/arith.mu.html @@ -94,19 +94,19 @@ if ('onhashchange' in window) { 35 fn main -> exit-status/ebx: int { 36 var look/esi: byte <- copy 0 # lookahead 37 var n/eax: int <- copy 0 # result of each expression - 38 print-string "press ctrl-c or ctrl-d to exit\n" + 38 print-string-to-screen "press ctrl-c or ctrl-d to exit\n" 39 # read-eval-print loop 40 { 41 # print prompt - 42 print-string "> " + 42 print-string-to-screen "> " 43 # read and eval 44 n, look <- simplify # we explicitly thread 'look' everywhere 45 # if (look == 0) break 46 compare look, 0 47 break-if-= 48 # print - 49 print-int32-to-screen n - 50 print-string "\n" + 49 print-int32-to-screen n + 50 print-string-to-screen "\n" 51 # 52 loop 53 } @@ -115,7 +115,7 @@ if ('onhashchange' in window) { 56 57 fn simplify -> result/eax: int, look/esi: byte { 58 # prime the pump - 59 look <- get-char # prime the pump + 59 look <- get-char 60 # do it 61 result, look <- expression look 62 } @@ -218,14 +218,14 @@ if ('onhashchange' in window) { 159 break $factor:body 160 } 161 # otherwise recurse -162 look <- get-char look # '(' +162 look <- get-char # '(' 163 result, look <- expression look 164 look <- skip-spaces look -165 look <- get-char look # ')' +165 look <- get-char # ')' 166 } # $factor:body 167 } 168 -169 fn is-mul-or-div? c: byte -> result/eax: bool { +169 fn is-mul-or-div? c: byte -> result/eax: boolean { 170 $is-mul-or-div?:body: { 171 compare c, 0x2a # '*' 172 { @@ -243,7 +243,7 @@ if ('onhashchange' in window) { 184 } # $is-mul-or-div?:body 185 } 186 -187 fn is-add-or-sub? c: byte -> result/eax: bool { +187 fn is-add-or-sub? c: byte -> result/eax: boolean { 188 $is-add-or-sub?:body: { 189 compare c, 0x2b # '+' 190 { @@ -270,13 +270,13 @@ if ('onhashchange' in window) { 211 look <- copy _look # should be a no-op 212 var out/edi: int <- copy 0 213 { -214 var first-digit/eax: int <- to-decimal-digit look +214 var first-digit/eax: int <- to-decimal-digit look 215 out <- copy first-digit 216 } 217 { 218 look <- get-char 219 # done? -220 var digit?/eax: bool <- is-decimal-digit? look +220 var digit?/eax: boolean <- is-decimal-digit? look 221 compare digit?, 0 # false 222 break-if-= 223 # out *= 10 @@ -285,7 +285,7 @@ if ('onhashchange' in window) { 226 out <- multiply ten 227 } 228 # out += digit(look) -229 var digit/eax: int <- to-decimal-digit look +229 var digit/eax: int <- to-decimal-digit look 230 out <- add digit 231 loop 232 } @@ -308,7 +308,7 @@ if ('onhashchange' in window) { 249 compare look, 0 250 { 251 break-if-!= -252 print-string "^D\n" +252 print-string-to-screen "^D\n" 253 syscall_exit 254 } 255 } -- cgit 1.4.1-2-gfad0