diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:36:44 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-01-27 00:36:44 -0800 |
commit | 71eb22a5bf94f5fa0a3c95212450e3c6a1a6a990 (patch) | |
tree | 56307b5145be44b2239d3c782234309ed714f1b6 /apps | |
parent | 1a65c3af0f797892f5981f8ebd33c275c1ef06b0 (diff) | |
download | mu-71eb22a5bf94f5fa0a3c95212450e3c6a1a6a990.tar.gz |
5924
Diffstat (limited to 'apps')
-rw-r--r-- | apps/assort.subx | 36 | ||||
-rw-r--r-- | apps/braces.subx | 18 | ||||
-rw-r--r-- | apps/calls.subx | 50 | ||||
-rw-r--r-- | apps/crenshaw2-1.subx | 18 | ||||
-rw-r--r-- | apps/crenshaw2-1b.subx | 22 | ||||
-rw-r--r-- | apps/dquotes.subx | 52 | ||||
-rw-r--r-- | apps/ex10.subx | 2 | ||||
-rw-r--r-- | apps/ex11.subx | 6 | ||||
-rw-r--r-- | apps/ex8.subx | 2 | ||||
-rw-r--r-- | apps/ex9.subx | 2 | ||||
-rw-r--r-- | apps/factorial.subx | 6 | ||||
-rw-r--r-- | apps/factorial2.subx | 6 | ||||
-rw-r--r-- | apps/factorial3.subx | 4 | ||||
-rw-r--r-- | apps/factorial4.subx | 4 | ||||
-rw-r--r-- | apps/handle.subx | 22 | ||||
-rw-r--r-- | apps/hex.subx | 32 | ||||
-rwxr-xr-x | apps/mu | bin | 82562 -> 82561 bytes | |||
-rw-r--r-- | apps/mu.subx | 448 | ||||
-rw-r--r-- | apps/mulisp.subx | 22 | ||||
-rw-r--r-- | apps/pack.subx | 122 | ||||
-rw-r--r-- | apps/sigils.subx | 48 | ||||
-rw-r--r-- | apps/survey.subx | 104 | ||||
-rw-r--r-- | apps/tests.subx | 10 |
23 files changed, 518 insertions, 518 deletions
diff --git a/apps/assort.subx b/apps/assort.subx index e6914978..d0b11485 100644 --- a/apps/assort.subx +++ b/apps/assort.subx @@ -60,7 +60,7 @@ Entry: # run tests if necessary, convert stdin if not eb/jump $subx-assort-main:end/disp8 $subx-assort-main:interactive: # - otherwise convert stdin - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -86,9 +86,9 @@ $subx-assort-main:end: # table: (addr stream {string, (addr stream byte)}) (8 bytes per row) # inefficient; uses sequential search for looking up segments by name -subx-assort: # in : (addr buffered-file), out : (addr buffered-file) +subx-assort: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var table : (addr stream {string, (addr stream byte)} 10/rows) + # var table: (addr stream {string, (addr stream byte)} 10/rows) # read-segments(in, table) # write-segments(out, table) # @@ -97,7 +97,7 @@ subx-assort: # in : (addr buffered-file), out : (addr buffered-file) 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 51/push-ecx - # var table/ecx : (stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row + # var table/ecx: (stream {string, (addr stream byte)} 80) # 10 rows * 8 bytes/row 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x50/imm32 # subtract from esp 68/push 0x50/imm32/length 68/push 0/imm32/read @@ -453,10 +453,10 @@ test-subx-assort: # type string_key = (addr array byte) # beware: leaks memory (one name per segment read) -read-segments: # in : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)}) +read-segments: # in: (addr buffered-file), table: (addr stream {string_key, (handle stream byte)}) # pseudocode: - # var curr-segment : (handle stream byte) = 0 - # var line : (stream byte 512) + # var curr-segment: (handle stream byte) = 0 + # var line: (stream byte 512) # while true # clear-stream(line) # read-line-buffered(in, line) @@ -496,13 +496,13 @@ read-segments: # in : (addr buffered-file), table : (addr stream {string_key, ( 52/push-edx 53/push-ebx 56/push-esi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -599,9 +599,9 @@ $read-segments:check-for-comment: #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp #? # }}} # if (slice-starts-with?(word-slice, "#")) continue - # . var start/esi : (addr byte) = word-slice->start + # . var start/esi: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . . # copy *ecx to esi - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . . # copy byte at *esi to AL # . if (c == '#') continue @@ -717,7 +717,7 @@ $read-segments:check-for-segment-header: #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp #? # }}} - # var segment-slot/eax : (addr handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8) + # var segment-slot/eax: (addr handle stream byte) = leaky-get-or-insert-slice(table, segment-name, row-size=8) # . . push args 68/push 8/imm32/row-size 52/push-edx @@ -726,7 +726,7 @@ $read-segments:check-for-segment-header: e8/call leaky-get-or-insert-slice/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32 # add to esp - # var curr-segment/ebx : (handle stream byte) = *segment-slot + # var curr-segment/ebx: (handle stream byte) = *segment-slot 8b/copy 0/mod/indirect 0/rm32/eax . . . 3/r32/ebx . . # copy *eax to ebx # if (curr-segment != 0) continue 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32 # compare ebx @@ -843,7 +843,7 @@ $read-segments:end: 5d/pop-to-ebp c3/return -write-segments: # out : (addr buffered-file), table : (addr stream {string_key, (handle stream byte)}) +write-segments: # out: (addr buffered-file), table: (addr stream {string_key, (handle stream byte)}) # pseudocode: # var curr = table->data # var max = &table->data[table->write] @@ -862,17 +862,17 @@ write-segments: # out : (addr buffered-file), table : (addr stream {string_key, 56/push-esi # esi = table 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi - # var write/edx : int = table->write + # var write/edx: int = table->write 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx - # var curr/esi : (addr byte) = table->data + # var curr/esi: (addr byte) = table->data 81 0/subop/add 3/mod/direct 6/rm32/esi . . . . . 0xc/imm32 # add to eax - # var max/edx : (addr byte) = curr + write + # var max/edx: (addr byte) = curr + write 01/add 3/mod/direct 2/rm32/edx . . . 6/r32/esi . . # add esi to edx $write-segments:loop: # if (curr >= max) break 39/compare 3/mod/direct 6/rm32/esi . . . 2/r32/edx . . # compare esi with edx 73/jump-if-addr>= $write-segments:break/disp8 - # var stream/eax : (addr stream byte) = table[i].stream + # var stream/eax: (addr stream byte) = table[i].stream 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 . # copy *(esi+4) to eax # write-stream-data(out, stream) # . . push args diff --git a/apps/braces.subx b/apps/braces.subx index edb72393..a165aeb3 100644 --- a/apps/braces.subx +++ b/apps/braces.subx @@ -75,11 +75,11 @@ $subx-braces-main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -subx-braces: # in : (addr buffered-file), out : (addr buffered-file) +subx-braces: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var line : (stream byte 512) - # var label-stack : (stack int 32) # at most 32 levels of nesting - # var next-label-id : int = 1 + # var line: (stream byte 512) + # var label-stack: (stack int 32) # at most 32 levels of nesting + # var next-label-id: int = 1 # while true # clear-stream(line) # read-line-buffered(in, line) @@ -95,7 +95,7 @@ subx-braces: # in : (addr buffered-file), out : (addr buffered-file) # print(out, "_break" top ":\n") # continue # while true - # var word-slice : (addr slice) = next-word-or-string(line) + # var word-slice: (addr slice) = next-word-or-string(line) # if slice-empty?(word-slice) # end of line # break # if slice-starts-with?(word-slice, "#") # comment @@ -123,20 +123,20 @@ subx-braces: # in : (addr buffered-file), out : (addr buffered-file) 57/push-edi # esi = in 8b/-> *(ebp+8) 6/r32/esi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp - # var label-stack/edx : (stack int 32) + # var label-stack/edx: (stack int 32) 81 5/subop/subtract %esp 0x80/imm32 68/push 0x80/imm32/length 68/push 0/imm32/top 89/<- %edx 4/r32/esp - # var next-label-id/ebx : int = 1 + # var next-label-id/ebx: int = 1 c7 0/subop/copy %ebx 1/imm32 - # var word-slice/edi : slice + # var word-slice/edi: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %edi 4/r32/esp diff --git a/apps/calls.subx b/apps/calls.subx index 7d7d560b..e569a258 100644 --- a/apps/calls.subx +++ b/apps/calls.subx @@ -75,10 +75,10 @@ $subx-calls-main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -subx-calls: # in : (addr buffered-file), out : (addr buffered-file) +subx-calls: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var line : (stream byte 512) - # var words : (stream slice 16) # at most function name and 15 args + # var line: (stream byte 512) + # var words: (stream slice 16) # at most function name and 15 args # while true # clear-stream(line) # read-line-buffered(in, line) @@ -105,13 +105,13 @@ subx-calls: # in : (addr buffered-file), out : (addr buffered-file) 51/push-ecx 52/push-edx 56/push-esi - # var line/esi : (stream byte 512) + # var line/esi: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %esi 4/r32/esp - # var words/edx : (stream slice 128) # 16 rows * 8 bytes/row + # var words/edx: (stream slice 128) # 16 rows * 8 bytes/row 81 5/subop/subtract %esp 0x80/imm32 68/push 0x80/imm32/length 68/push 0/imm32/read @@ -232,9 +232,9 @@ $subx-calls:end: 5d/pop-to-ebp c3/return -parse-line: # line : (addr stream byte), words : (addr stream slice) +parse-line: # line: (addr stream byte), words: (addr stream slice) # pseudocode: - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word-string-or-expression-without-metadata(line) # if slice-empty?(word-slice) @@ -247,7 +247,7 @@ parse-line: # line : (addr stream byte), words : (addr stream slice) 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -341,7 +341,7 @@ $parse-line:end: 5d/pop-to-ebp c3/return -emit-call: # out : (addr buffered-file), words : (addr stream slice) +emit-call: # out: (addr buffered-file), words: (addr stream slice) # pseudocode: # if (words->write < 8) abort # curr = &words->data[words->write-8] @@ -382,9 +382,9 @@ emit-call: # out : (addr buffered-file), words : (addr stream slice) 8b/-> *esi 1/r32/ecx 81 5/subop/subtract %ecx 8/imm32 0f 8c/jump-if-< $emit-call:error1/disp32 - # var curr/ecx : (addr slice) = &words->data[words->write-8] + # var curr/ecx: (addr slice) = &words->data[words->write-8] 8d/copy-address *(esi+ecx+0xc) 1/r32/ecx - # var min/edx : (addr byte) = words->data + # var min/edx: (addr byte) = words->data 8d/copy-address *(esi+0xc) 2/r32/edx # - emit pushes $emit-call:push-loop: @@ -392,9 +392,9 @@ $emit-call:push-loop: 39/compare %ecx 2/r32/edx 0f 8e/jump-if-<= $emit-call:call-instruction/disp32 # if (*curr->start in '%' '*') goto push-rm32 - # . var start/eax : (addr byte) = curr->start + # . var start/eax: (addr byte) = curr->start 8b/-> *ecx 0/r32/eax - # . var c/eax : byte = *eax + # . var c/eax: byte = *eax 8b/-> *eax 0/r32/eax 81 4/subop/and %eax 0xff/imm32 # . if (c == '%') goto push-rm32 @@ -742,7 +742,7 @@ test-subx-calls-processes-calls: 5d/pop-to-ebp c3/return -next-word-string-or-expression-without-metadata: # line : (addr stream byte), out : (addr slice) +next-word-string-or-expression-without-metadata: # line: (addr stream byte), out: (addr slice) # pseudocode: # skip-chars-matching(line, ' ') # if line->read >= line->write # end of line @@ -831,7 +831,7 @@ $next-word-string-or-expression-without-metadata:check-for-comment: 8d/copy-address *(esi+ecx+0xc) 0/r32/eax 89/<- *edi 0/r32/eax # if (line->data[line->read] != '#') goto next check - # . var eax : byte = line->data[line->read] + # . var eax: byte = line->data[line->read] 31/xor %eax 0/r32/eax 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL # . if (eax != '#') goto next check @@ -1192,7 +1192,7 @@ test-next-word-string-or-expression-without-metadata: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1265,7 +1265,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-comment: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1338,7 +1338,7 @@ test-next-word-string-or-expression-without-metadata-returns-empty-slice-on-eof: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1380,7 +1380,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-literal: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1443,7 +1443,7 @@ test-next-word-string-or-expression-without-metadata-returns-string-with-escapes e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1506,7 +1506,7 @@ test-next-word-string-or-expression-without-metadata-returns-whole-expression: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1569,7 +1569,7 @@ test-next-word-string-or-expression-without-metadata-returns-eol-on-trailing-clo e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1624,7 +1624,7 @@ test-next-word-string-or-expression-without-metadata-handles-comment-after-trail e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1679,7 +1679,7 @@ test-next-word-string-or-expression-without-metadata-handles-newline-after-trail e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1734,7 +1734,7 @@ test-next-word-string-or-expression-without-metadata-stops-at-close-paren: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add %esp 4/imm32 - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp diff --git a/apps/crenshaw2-1.subx b/apps/crenshaw2-1.subx index e8ff7101..3273811d 100644 --- a/apps/crenshaw2-1.subx +++ b/apps/crenshaw2-1.subx @@ -67,7 +67,7 @@ Entry: # run tests if necessary, call 'compile' if not eb/jump $main:end/disp8 $run-main: # - otherwise read a program from stdin and emit its translation to stdout - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -90,7 +90,7 @@ $main:end: cd/syscall 0x80/imm8 # the main entry point -compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor) +compile: # in: (addr buffered-file), out: fd or (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -105,7 +105,7 @@ compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd e8/call get-char/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var num/ecx : (stream byte 7) + # var num/ecx: (stream byte 7) # Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes. # Sizing the stream just right buys us overflow-handling for free inside 'get-num'. # Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex. @@ -191,7 +191,7 @@ $compile:end: # space in 'out'. # Input comes from the global variable 'Look' (first byte) and the argument # 'in' (rest). We leave the next byte from 'in' into 'Look' on exit. -get-num: # in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor) +get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # pseudocode: # if (!is-digit?(Look)) expected(ed, err, "integer") # if out->write >= out->length @@ -339,7 +339,7 @@ test-get-num-reads-single-digit: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -428,7 +428,7 @@ test-get-num-aborts-on-non-digit-in-Look: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -470,7 +470,7 @@ test-get-num-aborts-on-non-digit-in-Look: ## helpers # write(f, "Error: "+s+" expected\n") then stop(ed, 1) -expected: # ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte) +expected: # ed: (addr exit-descriptor), f: fd or (addr stream byte), s: (addr array byte) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -512,7 +512,7 @@ $expected:dead-end: c3/return # read a byte from 'f', and save it in 'Look' -get-char: # f : (addr buffered-file) +get-char: # f: (addr buffered-file) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -535,7 +535,7 @@ $get-char:end: 5d/pop-to-ebp c3/return -is-digit?: # c : int -> eax : boolean +is-digit?: # c: int -> eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/apps/crenshaw2-1b.subx b/apps/crenshaw2-1b.subx index f382955c..be02fbb8 100644 --- a/apps/crenshaw2-1b.subx +++ b/apps/crenshaw2-1b.subx @@ -67,7 +67,7 @@ Entry: # run tests if necessary, call 'compile' if not eb/jump $main:end/disp8 $run-main: # - otherwise read a program from stdin and emit its translation to stdout - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -90,7 +90,7 @@ $main:end: cd/syscall 0x80/imm8 # the main entry point -compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor) +compile: # in: (addr buffered-file), out: fd or (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -105,7 +105,7 @@ compile: # in : (addr buffered-file), out : fd or (addr stream byte), err : fd e8/call get-char/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var num/ecx : (stream byte 7) + # var num/ecx: (stream byte 7) # Numbers can be 32 bits or 8 hex bytes long. One of them will be in 'Look', so we need space for 7 bytes. # Sizing the stream just right buys us overflow-handling for free inside 'get-num'. # Add 12 bytes for 'read', 'write' and 'length' fields, for a total of 19 bytes, or 0x13 in hex. @@ -191,7 +191,7 @@ $compile:end: # no space in 'out'. # Input comes from the global variable 'Look' (first byte) and the argument # 'in' (rest). We leave the next byte from 'in' into 'Look' on exit. -get-num: # in : (addr buffered-file), out : (addr stream byte), err : fd or (addr stream byte), ed : (addr exit-descriptor) +get-num: # in: (addr buffered-file), out: (addr stream byte), err: fd or (addr stream byte), ed: (addr exit-descriptor) # pseudocode: # if (!is-digit?(Look)) expected(ed, err, "integer") # do @@ -355,7 +355,7 @@ test-get-num-reads-single-digit: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -444,7 +444,7 @@ test-get-num-aborts-on-non-digit-in-Look: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -527,7 +527,7 @@ test-get-num-reads-multiple-digits: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -616,7 +616,7 @@ test-get-num-reads-multiple-digits-followed-by-nondigit: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'get-num' below - # . var ed/eax : exit-descriptor + # . var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # . tailor-exit-descriptor(ed, 16) @@ -664,7 +664,7 @@ test-get-num-reads-multiple-digits-followed-by-nondigit: ## helpers # write(f, "Error: "+s+" expected\n") then stop(ed, 1) -expected: # ed : (addr exit-descriptor), f : fd or (addr stream byte), s : (addr array byte) +expected: # ed: (addr exit-descriptor), f: fd or (addr stream byte), s: (addr array byte) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -706,7 +706,7 @@ $expected:dead-end: c3/return # read a byte from 'f', and save it in 'Look' -get-char: # f : (addr buffered-file) +get-char: # f: (addr buffered-file) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -729,7 +729,7 @@ $get-char:end: 5d/pop-to-ebp c3/return -is-digit?: # c : int -> eax : boolean +is-digit?: # c: int -> eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/apps/dquotes.subx b/apps/dquotes.subx index 38eb08fd..b4bd60ce 100644 --- a/apps/dquotes.subx +++ b/apps/dquotes.subx @@ -56,7 +56,7 @@ Entry: # run tests if necessary, convert stdin if not eb/jump $subx-dquotes-main:end/disp8 $subx-dquotes-main:interactive: # - otherwise convert stdin - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -82,10 +82,10 @@ $subx-dquotes-main:end: # line = words separated by ' ', maybe followed by comment starting with '#' # word = datum until '/', then 0 or more metadata separated by '/' -subx-dquotes: # in : (addr buffered-file), out : (addr buffered-file) +subx-dquotes: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var line : (stream byte 512) - # var new-data-segment : (handle stream byte) = new-stream(Heap, Segment-size, 1) + # var line: (stream byte 512) + # var new-data-segment: (handle stream byte) = new-stream(Heap, Segment-size, 1) # # write(new-data-segment, "== data\n") # # TODO: When it was originally written dquotes ran before assort, so @@ -125,13 +125,13 @@ subx-dquotes: # in : (addr buffered-file), out : (addr buffered-file) 53/push-ebx 56/push-esi 57/push-edi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -198,9 +198,9 @@ $subx-dquotes:check1: 0f 85/jump-if-!= $subx-dquotes:next-line/disp32 $subx-dquotes:check-for-comment: # if (slice-starts-with?(word-slice, "#")) continue - # . var start/esi : (addr byte) = word-slice->start + # . var start/esi: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . . # copy *edx to esi - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . . # copy byte at *esi to AL # . if (c == '#') continue @@ -287,7 +287,7 @@ $subx-dquotes:end: # Write out 'string-literal' in a new format to 'out-segment', assign it a new # label, and write the new label out to 'out'. -process-string-literal: # string-literal : (addr slice), out : (addr buffered-file), out-segment : (addr stream byte) +process-string-literal: # string-literal: (addr slice), out: (addr buffered-file), out-segment: (addr stream byte) # pseudocode: # print(out-segment, "_string#{Next-string-literal}:\n") # emit-string-literal-data(out-segment, string-literal) @@ -300,7 +300,7 @@ process-string-literal: # string-literal : (addr slice), out : (addr buffered-f 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 51/push-ecx - # var int32-stream/ecx : (stream byte 10) # number of decimal digits a 32-bit number can have + # var int32-stream/ecx: (stream byte 10) # number of decimal digits a 32-bit number can have 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa/imm32 # subtract from esp 68/push 0xa/imm32/decimal-digits-in-32bit-number 68/push 0/imm32/read @@ -846,7 +846,7 @@ test-subx-dquotes-processes-string-literals: c3/return # generate the data segment contents byte by byte for a given slice -emit-string-literal-data: # out : (addr stream byte), word : (addr slice) +emit-string-literal-data: # out: (addr stream byte), word: (addr slice) # pseudocode # len = string-length-at-start-of-slice(word->start, word->end) # print(out, "#{len}/imm32 ") @@ -885,14 +885,14 @@ emit-string-literal-data: # out : (addr stream byte), word : (addr slice) 56/push-esi # esi = word 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi - # var idx/ebx : int = 0 + # var idx/ebx: int = 0 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx - # var curr/edx : (addr byte) = word->start + # var curr/edx: (addr byte) = word->start 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . . # copy *esi to edx - # var max/esi : (addr byte) = word->end + # var max/esi: (addr byte) = word->end 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 . # copy *(esi+4) to esi $emit-string-literal-data:emit-length: - # var len/eax : int = string-length-at-start-of-slice(word->start, word->end) + # var len/eax: int = string-length-at-start-of-slice(word->start, word->end) # . . push args 56/push-esi 52/push-edx @@ -920,7 +920,7 @@ $emit-string-literal-data:emit-length: $emit-string-literal-data:loop-init: # ++curr # skip initial '"' 42/increment-edx - # var c/ecx : byte = 0 + # var c/ecx: byte = 0 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . . # clear ecx $emit-string-literal-data:loop: # if (curr >= max) break @@ -955,7 +955,7 @@ $emit-string-literal-data:emit: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # if (is-alphanumeric?(*curr)) print(out, "/#{*curr}") - # . var eax : boolean = is-alphanumeric?(CL) + # . var eax: boolean = is-alphanumeric?(CL) # . . push args 51/push-ecx # . . call @@ -1021,7 +1021,7 @@ $emit-string-literal-data:end: 5d/pop-to-ebp c3/return -is-alphanumeric?: # c : int -> eax : boolean +is-alphanumeric?: # c: int -> eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -1379,9 +1379,9 @@ test-emit-string-literal-data-handles-newline-escape: c3/return # emit everything from a word except the initial datum -emit-metadata: # out : (addr buffered-file), word : (addr slice) +emit-metadata: # out: (addr buffered-file), word: (addr slice) # pseudocode - # var slice : slice = {0, word->end} + # var slice: slice = {0, word->end} # curr = word->start # if *curr == '"' # curr = skip-string-in-slice(curr, word->end) @@ -1406,11 +1406,11 @@ emit-metadata: # out : (addr buffered-file), word : (addr slice) 56/push-esi # esi = word 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi - # var curr/ecx : (addr byte) = word->start + # var curr/ecx: (addr byte) = word->start 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . . # copy *esi to ecx - # var end/edx : (addr byte) = word->end + # var end/edx: (addr byte) = word->end 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 4/disp8 . # copy *(esi+4) to edx - # var slice/ebx : slice = {0, end} + # var slice/ebx: slice = {0, end} 52/push-edx 68/push 0/imm32 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx @@ -1778,7 +1778,7 @@ test-emit-metadata-in-string-literal: 5d/pop-to-ebp c3/return -string-length-at-start-of-slice: # curr : (addr byte), end : (addr byte) -> length/eax +string-length-at-start-of-slice: # curr: (addr byte), end: (addr byte) -> length/eax # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -1790,9 +1790,9 @@ string-length-at-start-of-slice: # curr : (addr byte), end : (addr byte) -> len 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 . # copy *(ebp+8) to ecx # edx = end 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 2/r32/edx 0xc/disp8 . # copy *(ebp+12) to edx - # var length/eax : int = 0 + # var length/eax: int = 0 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax - # var c/ebx : byte = 0 + # var c/ebx: byte = 0 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx # skip initial dquote 41/increment-ecx diff --git a/apps/ex10.subx b/apps/ex10.subx index a67ec6f7..7d821541 100644 --- a/apps/ex10.subx +++ b/apps/ex10.subx @@ -33,7 +33,7 @@ Entry: # return argv-equal(argv[1], argv[2]) # compare two null-terminated ascii strings # reason for the name: the only place we should have null-terminated ascii strings is from commandline args -argv-equal: # (s1, s2) : null-terminated ascii strings -> eax : boolean +argv-equal: # (s1, s2): null-terminated ascii strings -> eax: boolean # initialize s1 (ecx) and s2 (edx) 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 1/r32/ecx 4/disp8 . # copy *(esp+4) to ecx 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 2/r32/edx 8/disp8 . # copy *(esp+8) to edx diff --git a/apps/ex11.subx b/apps/ex11.subx index fb63b25c..7e21b643 100644 --- a/apps/ex11.subx +++ b/apps/ex11.subx @@ -27,7 +27,7 @@ Entry: # run all tests # compare a null-terminated ascii string with a more idiomatic length-prefixed byte array # reason for the name: the only place we should have null-terminated ascii strings is from commandline args -kernel-string-equal?: # s : null-terminated ascii string, benchmark : length-prefixed ascii string -> eax : boolean +kernel-string-equal?: # s: null-terminated ascii string, benchmark: length-prefixed ascii string -> eax: boolean # pseudocode: # n = benchmark->length # s1 = s @@ -258,7 +258,7 @@ test-compare-kernel-string-with-longer-array: # - helpers # print msg to stderr if a != b, otherwise print "." -check-ints-equal: # (a : int, b : int, msg : (addr array byte)) -> boolean +check-ints-equal: # (a: int, b: int, msg: (addr array byte)) -> boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -307,7 +307,7 @@ $check-ints-equal:end: 5d/pop-to-ebp c3/return -write-stderr: # s : (addr array byte) -> <void> +write-stderr: # s: (addr array byte) -> <void> # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/apps/ex8.subx b/apps/ex8.subx index e000bfca..45e49937 100644 --- a/apps/ex8.subx +++ b/apps/ex8.subx @@ -34,7 +34,7 @@ Entry: 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx e8/call syscall_exit/disp32 -ascii-length: # s : (addr array byte) -> n/eax +ascii-length: # s: (addr array byte) -> n/eax # edx = s 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none . 2/r32/edx 4/disp8 . # copy *(esp+4) to edx # var result/eax = 0 diff --git a/apps/ex9.subx b/apps/ex9.subx index 443e443e..a3cd4049 100644 --- a/apps/ex9.subx +++ b/apps/ex9.subx @@ -38,7 +38,7 @@ Entry: 89/copy 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . . # copy eax to ebx e8/call syscall_exit/disp32 -ascii-difference: # (s1, s2) : null-terminated ascii strings +ascii-difference: # (s1, s2): null-terminated ascii strings # a = first letter of s1 (ecx) 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/esp 4/index/none 0/r32/eax 4/disp8 . # copy *(esp+4) to eax 8b/copy 0/mod/indirect 0/rm32/eax . . . 0/r32/eax . . # copy *eax to eax diff --git a/apps/factorial.subx b/apps/factorial.subx index aebd2a12..d8dc894a 100644 --- a/apps/factorial.subx +++ b/apps/factorial.subx @@ -68,7 +68,7 @@ $main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -factorial: # n : int -> int/eax +factorial: # n: int -> int/eax # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -77,10 +77,10 @@ factorial: # n : int -> int/eax b8/copy-to-eax 1/imm32 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 1/imm32 # compare *(ebp+8) 7e/jump-if-<= $factorial:end/disp8 - # var ebx : int = n-1 + # var ebx: int = n-1 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 3/r32/ebx 8/disp8 . # copy *(ebp+8) to ebx 4b/decrement-ebx - # var eax : int = factorial(n-1) + # var eax: int = factorial(n-1) # . . push args 53/push-ebx # . . call diff --git a/apps/factorial2.subx b/apps/factorial2.subx index 7e0a737d..7c76cc9a 100644 --- a/apps/factorial2.subx +++ b/apps/factorial2.subx @@ -68,7 +68,7 @@ $main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -factorial: # n : int -> int/eax +factorial: # n: int -> int/eax # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -77,10 +77,10 @@ factorial: # n : int -> int/eax b8/copy-to-eax 1/imm32 81 7/subop/compare *(ebp+8) 1/imm32 7e/jump-if-<= $factorial:end/disp8 - # var ebx : int = n-1 + # var ebx: int = n-1 8b/-> *(ebp+8) 3/r32/ebx 4b/decrement-ebx - # var eax : int = factorial(n-1) + # var eax: int = factorial(n-1) # . . push args 53/push-ebx # . . call diff --git a/apps/factorial3.subx b/apps/factorial3.subx index e6bcf959..dd0fd888 100644 --- a/apps/factorial3.subx +++ b/apps/factorial3.subx @@ -49,7 +49,7 @@ $main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -factorial: # n : int -> int/eax +factorial: # n: int -> int/eax # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -59,7 +59,7 @@ factorial: # n : int -> int/eax b8/copy-to-eax 1/imm32 81 7/subop/compare *(ebp+8) 1/imm32 7e/jump-if-<= $factorial:end/disp8 - # var ebx : int = n-1 + # var ebx: int = n-1 8b/-> *(ebp+8) 3/r32/ebx 4b/decrement-ebx # diff --git a/apps/factorial4.subx b/apps/factorial4.subx index 5f8c6aef..eb42adf2 100644 --- a/apps/factorial4.subx +++ b/apps/factorial4.subx @@ -55,7 +55,7 @@ Entry: # run tests if necessary, compute `factorial(5)` if not b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -factorial: # n : int -> int/eax +factorial: # n: int -> int/eax # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -70,7 +70,7 @@ factorial: # n : int -> int/eax # if (n > 1) return n * factorial(n-1) { 7e/jump-if-<= break/disp8 - # var ebx : int = n-1 + # var ebx: int = n-1 8b/-> *(ebp+8) 3/r32/ebx 4b/decrement-ebx (factorial %ebx) # => eax diff --git a/apps/handle.subx b/apps/handle.subx index 37fb9030..27052fc4 100644 --- a/apps/handle.subx +++ b/apps/handle.subx @@ -44,7 +44,7 @@ $handle-main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -new: # ad : (addr allocation-descriptor), n : int, out : (handle _) +new: # ad: (addr allocation-descriptor), n: int, out: (handle _) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -55,7 +55,7 @@ new: # ad : (addr allocation-descriptor), n : int, out : (handle _) # ecx = n+4 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 0xc/disp8 . # copy *(ebp+12) to ecx 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32 # add to ecx - # var eax : (handle _) = allocate(ad, ecx) + # var eax: (handle _) = allocate(ad, ecx) # . . push args 51/push-ecx ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) @@ -96,7 +96,7 @@ test-new: # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # var heap/edx : allocation-descriptor + # var heap/edx: allocation-descriptor 68/push 0/imm32/limit 68/push 0/imm32/curr 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -110,7 +110,7 @@ test-new: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # *Next-alloc-id = 0x34 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32 # copy to *Next-alloc-id - # var handle/ecx : handle + # var handle/ecx: handle 68/push 0/imm32/address 68/push 0/imm32/alloc-id 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -166,7 +166,7 @@ _pending-test-new-failure: # . *Next-alloc-id = 0x34 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . Next-alloc-id/disp32 0x34/imm32 # copy to *Next-alloc-id # define an allocation-descriptor with no space left - # . var ad/eax : allocation-descriptor = {0x10, 0x10} + # . var ad/eax: allocation-descriptor = {0x10, 0x10} 68/push 0x10/imm32/limit 68/push 0x10/imm32/curr 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax @@ -221,7 +221,7 @@ _pending-test-new-failure: 5d/pop-to-ebp c3/return -lookup: # h : (handle T) -> eax : (addr T) +lookup: # h: (handle T) -> eax: (addr T) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -282,7 +282,7 @@ test-lookup-success: 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers - # var heap/ebx : allocation-descriptor + # var heap/ebx: allocation-descriptor 68/push 0/imm32/limit 68/push 0/imm32/curr 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx @@ -294,7 +294,7 @@ test-lookup-success: e8/call new-segment/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # var handle/ecx : handle + # var handle/ecx: handle 68/push 0/imm32/address 68/push 0/imm32/alloc-id 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -350,7 +350,7 @@ test-lookup-failure: # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp - # var heap/esi : allocation-descriptor + # var heap/esi: allocation-descriptor 68/push 0/imm32/limit 68/push 0/imm32/curr 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . . # copy esp to esi @@ -362,7 +362,7 @@ test-lookup-failure: e8/call new-segment/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # var h1/ecx : handle + # var h1/ecx: handle 68/push 0/imm32/address 68/push 0/imm32/alloc-id 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -381,7 +381,7 @@ test-lookup-failure: # reset heap->curr to mimic reclamation 89/copy 0/mod/indirect 6/rm32/esi . . . 3/r32/ebx . . # copy ebx to *esi # second allocation that returns the same address as the first - # var h2/edx : handle + # var h2/edx: handle 68/push 0/imm32/address 68/push 0/imm32/alloc-id 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx diff --git a/apps/hex.subx b/apps/hex.subx index 21fd1939..11107aef 100644 --- a/apps/hex.subx +++ b/apps/hex.subx @@ -54,7 +54,7 @@ Entry: # run tests if necessary, convert stdin if not eb/jump $subx-hex-main:end/disp8 $subx-hex-main:interactive: # - otherwise convert stdin - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -77,7 +77,7 @@ $subx-hex-main:end: cd/syscall 0x80/imm8 # the main entry point -subx-hex: # in : (addr buffered-file), out : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor) +subx-hex: # in: (addr buffered-file), out: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) # pseudocode: # while true # eax = convert-next-octet(in, err, ed) @@ -135,7 +135,7 @@ $subx-hex:end: # raise an error and abort on all other unexpected bytes # return in eax an _octet_ containing the binary value of the two hex characters # return Eof on reaching end of file -convert-next-octet: # in : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor) -> byte-or-Eof/eax +convert-next-octet: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) -> byte-or-Eof/eax # pseudocode: # eax = scan-next-byte(in, err, ed) # if (eax == Eof) return @@ -247,7 +247,7 @@ test-convert-next-octet: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -337,7 +337,7 @@ test-convert-next-octet-handles-Eof: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # don't initialize '_test-stream' # initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -435,7 +435,7 @@ test-convert-next-octet-aborts-on-single-hex-byte: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'convert-next-octet' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -481,7 +481,7 @@ $test-convert-next-octet-aborts-on-single-hex-byte:end: # return Eof if file ends without finding a hex byte # on '#' skip all bytes until newline # abort on any other byte -scan-next-byte: # in : (addr buffered-file), err : (addr buffered-file), ed : (addr exit-descriptor) -> byte-or-Eof/eax +scan-next-byte: # in: (addr buffered-file), err: (addr buffered-file), ed: (addr exit-descriptor) -> byte-or-Eof/eax # pseudocode: # while true # eax = read-byte-buffered(in) @@ -604,7 +604,7 @@ test-scan-next-byte: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -702,7 +702,7 @@ test-scan-next-byte-skips-whitespace: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -808,7 +808,7 @@ test-scan-next-byte-skips-comment: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -914,7 +914,7 @@ test-scan-next-byte-skips-comment-and-whitespace: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -1022,7 +1022,7 @@ test-scan-next-byte-skips-whitespace-and-comment: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -1120,7 +1120,7 @@ test-scan-next-byte-reads-final-byte: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -1210,7 +1210,7 @@ test-scan-next-byte-handles-Eof: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # leave '_test-stream' empty # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -1308,7 +1308,7 @@ test-scan-next-byte-aborts-on-invalid-byte: # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # initialize exit-descriptor 'ed' for the call to 'scan-next-byte' below - # . var ed/ecx : exit-descriptor + # . var ed/ecx: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx # . tailor-exit-descriptor(ed, 12) @@ -1350,7 +1350,7 @@ $test-scan-next-byte-aborts-on-invalid-byte:end: 5d/pop-to-ebp c3/return -skip-until-newline: # in : (addr buffered-file) +skip-until-newline: # in: (addr buffered-file) # pseudocode: # push eax # while true diff --git a/apps/mu b/apps/mu index bccdfe1e..22e52d86 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx index 16c83e43..c527535d 100644 --- a/apps/mu.subx +++ b/apps/mu.subx @@ -70,12 +70,12 @@ # The type of a local variable is either word-length (4 bytes) or starts with 'ref'. # # - variables definitions in a register. E.g.: -# - var foo/eax : int <- add bar 1 +# - var foo/eax: int <- add bar 1 # The initializer is mandatory and must be a valid instruction that writes # a single output to the right register. In practice registers will # usually be either initialized by primitives or copied from eax. -# - var eax : int <- foo bar quux -# var floo/ecx : int <- copy eax +# - var eax: int <- foo bar quux +# var floo/ecx: int <- copy eax # # Still todo: # global variables @@ -388,7 +388,7 @@ $mu-main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -convert-mu: # in : (addr buffered-file), out : (addr buffered-file) +convert-mu: # in: (addr buffered-file), out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -962,11 +962,11 @@ test-convert-function-call-with-literal-arg: # Parsing ####################################################### -parse-mu: # in : (addr buffered-file) +parse-mu: # in: (addr buffered-file) # pseudocode - # var curr-function : (addr (handle function)) = Program - # var line : (stream byte 512) - # var word-slice : slice + # var curr-function: (addr (handle function)) = Program + # var line: (stream byte 512) + # var word-slice: slice # while true # line loop # clear-stream(line) # read-line-buffered(in, line) @@ -977,8 +977,8 @@ parse-mu: # in : (addr buffered-file) # else if slice-starts-with?(word-slice, "#") # comment # continue # end of line # else if slice-equal(word-slice, "fn") - # var new-function : (handle function) = allocate(function) - # var vars : (stack (addr var) 256) + # var new-function: (handle function) = allocate(function) + # var vars: (stack (addr var) 256) # populate-mu-function-header(in, new-function, vars) # populate-mu-function-body(in, new-function, vars) # assert(vars->top == 0) @@ -996,19 +996,19 @@ parse-mu: # in : (addr buffered-file) 52/push-edx 53/push-ebx 57/push-edi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %edx 4/r32/esp - # var curr-function/edi : (addr (handle function)) = Program + # var curr-function/edi: (addr (handle function)) = Program bf/copy-to-edi Program/imm32 - # var vars/ebx : (stack (addr var) 256) + # var vars/ebx: (stack (addr var) 256) 81 5/subop/subtract %esp 0x400/imm32 68/push 0x400/imm32/length 68/push 0/imm32/top @@ -1045,7 +1045,7 @@ $parse-mu:fn: (slice-equal? %edx "fn") 3d/compare-eax-and 0/imm32 0f 84/jump-if-= break/disp32 - # var new-function/eax : (handle function) = populate-mu-function(in, new-function, vars) + # var new-function/eax: (handle function) = populate-mu-function(in, new-function, vars) (allocate Heap *Function-size) # => eax (zero-out %eax *Function-size) (clear-stack %ebx) @@ -1106,17 +1106,17 @@ $parse-mu:error2: # ✗ fn foo { } # ✗ fn foo { } { # ✗ fn foo x { -# ✗ fn foo x : { -# ✓ fn foo x : int { +# ✗ fn foo x: { +# ✓ fn foo x: int { # ✓ fn foo x: int { # ✓ fn foo x: int -> y/eax: int { -populate-mu-function-header: # first-line : (addr stream byte), out : (handle function), vars : (addr stack (handle var)) +populate-mu-function-header: # first-line: (addr stream byte), out: (handle function), vars: (addr stack (handle var)) # pseudocode: - # var name : slice + # var name: slice # next-word(first-line, name) # assert(name not in '{' '}' '->') # out->name = slice-to-string(name) - # var next-offset : int = 8 + # var next-offset: int = 8 # ## inouts # while true # ## name @@ -1124,7 +1124,7 @@ populate-mu-function-header: # first-line : (addr stream byte), out : (handle f # if (name == '{') goto done # if (name == '->') break # assert(name != '}') - # var v : (handle var) = parse-var-with-type(name, first-line) + # var v: (handle var) = parse-var-with-type(name, first-line) # assert(v->register == null) # v->stack-offset = next-offset # next-offset += size-of(v) @@ -1135,7 +1135,7 @@ populate-mu-function-header: # first-line : (addr stream byte), out : (handle f # ## name # name = next-word(first-line) # assert(name not in '{' '}' '->') - # var v : (handle var) = parse-var-with-type(name, first-line) + # var v: (handle var) = parse-var-with-type(name, first-line) # assert(v->register != null) # out->outputs = append(out->outputs, v) # done: @@ -1151,7 +1151,7 @@ populate-mu-function-header: # first-line : (addr stream byte), out : (handle f 57/push-edi # edi = out 8b/-> *(ebp+0xc) 7/r32/edi - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1193,7 +1193,7 @@ $populate-mu-function-header:check-for-inout: (slice-equal? %ecx "}") # => eax 3d/compare-eax-and 0/imm32 0f 85/jump-if-!= $populate-mu-function-header:error1/disp32 - # var v/ebx : (handle var) = parse-var-with-type(word-slice, first-line) + # var v/ebx: (handle var) = parse-var-with-type(word-slice, first-line) (parse-var-with-type %ecx *(ebp+8)) # => eax 89/<- %ebx 0/r32/eax # assert(v->register == null) @@ -1303,11 +1303,11 @@ test-function-header-with-arg: # setup (clear-stream _test-input-stream) (write _test-input-stream "foo n : int {\n") - # result/ecx : function + # var result/ecx: function 2b/subtract-> *Function-size 4/r32/esp 89/<- %ecx 4/r32/esp (zero-out %ecx *Function-size) - # var vars/ebx : (stack (addr var) 16) + # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top @@ -1316,9 +1316,9 @@ test-function-header-with-arg: (populate-mu-function-header _test-input-stream %ecx %ebx) # check result (check-strings-equal *ecx "foo" "F - test-function-header-with-arg/name") # Function-name - # edx : (handle list var) = result->inouts + # edx: (handle list var) = result->inouts 8b/-> *(ecx+8) 2/r32/edx # Function-inouts - # ebx : (handle var) = result->inouts->value + # ebx: (handle var) = result->inouts->value 8b/-> *edx 3/r32/ebx # List-value (check-strings-equal *ebx "n" "F - test-function-header-with-arg/inout:0") # Var-name 8b/-> *(ebx+4) 3/r32/ebx # Var-type @@ -1337,11 +1337,11 @@ test-function-header-with-multiple-args: # setup (clear-stream _test-input-stream) (write _test-input-stream "foo a: int, b: int c: int {\n") - # result/ecx : (handle function) + # result/ecx: (handle function) 2b/subtract-> *Function-size 4/r32/esp 89/<- %ecx 4/r32/esp (zero-out %ecx *Function-size) - # var vars/ebx : (stack (addr var) 16) + # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top @@ -1350,10 +1350,10 @@ test-function-header-with-multiple-args: (populate-mu-function-header _test-input-stream %ecx %ebx) # check result (check-strings-equal *ecx "foo") # Function-name - # edx : (handle list var) = result->inouts + # edx: (handle list var) = result->inouts 8b/-> *(ecx+8) 2/r32/edx # Function-inouts $test-function-header-with-multiple-args:inout0: - # ebx : (handle var) = result->inouts->value + # ebx: (handle var) = result->inouts->value 8b/-> *edx 3/r32/ebx # List-value (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args/inout:0") # Var-name 8b/-> *(ebx+4) 3/r32/ebx # Var-type @@ -1389,12 +1389,12 @@ test-function-with-multiple-args-and-outputs: 89/<- %ebp 4/r32/esp # setup (clear-stream _test-input-stream) - (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx : int {\n") - # result/ecx : (handle function) + (write _test-input-stream "foo a: int, b: int, c: int -> x/ecx: int y/edx: int {\n") + # result/ecx: (handle function) 2b/subtract-> *Function-size 4/r32/esp 89/<- %ecx 4/r32/esp (zero-out %ecx *Function-size) - # var vars/ebx : (stack (addr var) 16) + # var vars/ebx: (stack (addr var) 16) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top @@ -1403,9 +1403,9 @@ test-function-with-multiple-args-and-outputs: (populate-mu-function-header _test-input-stream %ecx %ebx) # check result (check-strings-equal *ecx "foo") # Function-name - # edx : (handle list var) = result->inouts + # edx: (handle list var) = result->inouts 8b/-> *(ecx+8) 2/r32/edx # Function-inouts - # ebx : (handle var) = result->inouts->value + # ebx: (handle var) = result->inouts->value 8b/-> *edx 3/r32/ebx # List-value (check-strings-equal *ebx "a" "F - test-function-header-with-multiple-args-and-outputs/inout:0") # Var-name 8b/-> *(ebx+4) 3/r32/ebx # Var-type @@ -1427,9 +1427,9 @@ test-function-with-multiple-args-and-outputs: 8b/-> *(ebx+4) 3/r32/ebx # Var-type (check-ints-equal *ebx 1 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:0") # Tree-left (check-ints-equal *(ebx+4) 0 "F - test-function-header-with-multiple-args-and-outputs/inout:2/type:1") # Tree-right - # edx : (handle list var) = result->outputs + # edx: (handle list var) = result->outputs 8b/-> *(ecx+0xc) 2/r32/edx # Function-outputs - # ebx : (handle var) = result->outputs->value + # ebx: (handle var) = result->outputs->value 8b/-> *edx 3/r32/ebx # List-value (check-strings-equal *ebx "x" "F - test-function-header-with-multiple-args-and-outputs/output:0") # Var-name (check-strings-equal *(ebx+0x10) "ecx" "F - test-function-header-with-multiple-args-and-outputs/output:0/register") # Var-register @@ -1451,16 +1451,16 @@ test-function-with-multiple-args-and-outputs: c3/return # format for variables with types -# x : int +# x: int # x: int # x: int, # ignores at most one trailing colon or comma parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> result/eax: (handle var) # pseudocode: - # var v : (handle var) = allocate(Heap, Var-size) - # var s : slice + # var v: (handle var) = allocate(Heap, Var-size) + # var s: slice # next-token-from-slice(name->start, name->end, '/', s) - # var end : (addr byte) = s->end + # var end: (addr byte) = s->end # if (slice-ends-with(s, ":")) # decrement s->end # if (slice-ends-with(s, ",")) @@ -1475,7 +1475,7 @@ parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> re # if (!slice-empty?(s)) # v->register = slice-to-string(s) # ## type - # var type : (handle tree type-id) = parse-type(first-line) + # var type: (handle tree type-id) = parse-type(first-line) # v->type = type # return v # @@ -1488,13 +1488,13 @@ parse-var-with-type: # name: (addr slice), first-line: (addr stream byte) -> re 53/push-ebx 56/push-esi 57/push-edi - # var result/edi : (handle var) = allocate(Heap, Var-size) + # var result/edi: (handle var) = allocate(Heap, Var-size) (allocate Heap *Var-size) # => eax (zero-out %eax *Var-size) 89/<- %edi 0/r32/eax # esi = name 8b/-> *(ebp+8) 6/r32/esi - # var s/ecx : slice + # var s/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -1834,7 +1834,7 @@ $next-mu-token:check0: # out->start = &in->data[in->read] 8d/copy-address *(esi+ecx+0xc) 0/r32/eax 89/<- *edi 0/r32/eax - # var curr-byte/eax : byte = in->data[in->read] + # var curr-byte/eax: byte = in->data[in->read] 31/xor %eax 0/r32/eax 8a/copy-byte *(esi+ecx+0xc) 0/r32/AL { @@ -2076,7 +2076,7 @@ test-parse-var-with-type: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2104,7 +2104,7 @@ test-parse-var-with-type-and-register: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2134,7 +2134,7 @@ test-parse-var-with-trailing-characters: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2164,7 +2164,7 @@ test-parse-var-with-register-and-trailing-characters: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2194,7 +2194,7 @@ test-parse-var-with-compound-type: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2226,7 +2226,7 @@ test-parse-var-with-compound-type: # identifier starts with a letter or '$' or '_' # no constraints at the moment on later letters # all we really want to do so far is exclude '{', '}' and '->' -is-identifier?: # in : (addr slice) -> result/eax : boolean +is-identifier?: # in: (addr slice) -> result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -2234,7 +2234,7 @@ is-identifier?: # in : (addr slice) -> result/eax : boolean (slice-empty? *(ebp+8)) # => eax 3d/compare-eax-and 0/imm32 75/jump-if-!= $is-identifier?:false/disp8 - # var c/eax : byte = *in->start + # var c/eax: byte = *in->start 8b/-> *(ebp+8) 0/r32/eax 8b/-> *eax 0/r32/eax 8a/copy-byte *eax 0/r32/AL @@ -2274,7 +2274,7 @@ test-is-identifier-dollar: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2295,7 +2295,7 @@ test-is-identifier-underscore: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2316,7 +2316,7 @@ test-is-identifier-a: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2337,7 +2337,7 @@ test-is-identifier-z: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2358,7 +2358,7 @@ test-is-identifier-A: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2379,7 +2379,7 @@ test-is-identifier-Z: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2401,7 +2401,7 @@ test-is-identifier-@: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2423,7 +2423,7 @@ test-is-identifier-square-bracket: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2445,7 +2445,7 @@ test-is-identifier-backtick: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2467,7 +2467,7 @@ test-is-identifier-curly-brace-open: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2488,7 +2488,7 @@ test-is-identifier-curly-brace-close: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2510,7 +2510,7 @@ test-is-identifier-hyphen: 8b/-> *eax 1/r32/ecx 8d/copy-address *(eax+ecx+4) 1/r32/ecx 05/add-to-eax 4/imm32 - # var slice/ecx : slice = {eax, ecx} + # var slice/ecx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/<- %ecx 4/r32/esp @@ -2522,7 +2522,7 @@ test-is-identifier-hyphen: 5d/pop-to-ebp c3/return -populate-mu-function-body: # in : (addr buffered-file), out : (handle function), vars : (addr stack (handle var)) +populate-mu-function-body: # in: (addr buffered-file), out: (handle function), vars: (addr stack (handle var)) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -2534,7 +2534,7 @@ populate-mu-function-body: # in : (addr buffered-file), out : (handle function) 8b/-> *(ebp+8) 6/r32/esi # edi = out 8b/-> *(ebp+0xc) 7/r32/edi - # var eax : (handle block) = parse-mu-block(in, vars) + # var eax: (handle block) = parse-mu-block(in, vars) (parse-mu-block %esi *(ebp+0x10) %edi) # => eax # out->body = eax 89/<- *(edi+0x10) 0/r32/eax # Function-body @@ -2549,10 +2549,10 @@ $populate-mu-function-body:end: c3/return # parses a block, assuming that the leading '{' has already been read by the caller -parse-mu-block: # in : (addr buffered-file), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle block) +parse-mu-block: # in: (addr buffered-file), vars: (addr stack (handle var)), fn: (handle function) -> result/eax: (handle block) # pseudocode: - # var line : (stream byte 512) - # var word-slice : slice + # var line: (stream byte 512) + # var word-slice: slice # result/eax = allocate(Heap, Stmt-size) # result->tag = 0/Block # while true # line loop @@ -2589,13 +2589,13 @@ parse-mu-block: # in : (addr buffered-file), vars : (addr stack (handle var)), 52/push-edx 53/push-ebx 57/push-edi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/<- %ecx 4/r32/esp - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %edx 4/r32/esp @@ -2710,14 +2710,14 @@ $parse-mu-block:abort: cd/syscall 0x80/imm8 # never gets here -check-no-tokens-left: # line : (addr stream byte) +check-no-tokens-left: # line: (addr stream byte) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 50/push-eax 51/push-ecx - # var s/ecx : slice + # var s/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -2757,10 +2757,10 @@ $check-no-tokens-left:end: 5d/pop-to-ebp c3/return -parse-mu-named-block: # name : (addr slice), first-line : (addr stream byte), in : (addr buffered-file), vars : (addr stack (handle var)) -> result/eax : (handle stmt) +parse-mu-named-block: # name: (addr slice), first-line: (addr stream byte), in: (addr buffered-file), vars: (addr stack (handle var)) -> result/eax: (handle stmt) # pseudocode: - # var line : (stream byte 512) - # var word-slice : slice + # var line: (stream byte 512) + # var word-slice: slice # result/eax = allocate(Heap, Stmt-size) # result->tag = 4/Named-block # result->name = name @@ -2801,7 +2801,7 @@ $parse-mu-named-block:end: 5d/pop-to-ebp c3/return -parse-mu-var-def: # line : (addr stream byte), vars : (addr stack (handle var)) -> result/eax : (handle stmt) +parse-mu-var-def: # line: (addr stream byte), vars: (addr stack (handle var)) -> result/eax: (handle stmt) # pseudocode: # # . prologue @@ -2810,11 +2810,11 @@ parse-mu-var-def: # line : (addr stream byte), vars : (addr stack (handle var)) # . save registers 51/push-ecx 52/push-edx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp - # var v/edx : (handle var) = parse-var-with-type(line) + # var v/edx: (handle var) = parse-var-with-type(line) (next-word *(ebp+8) %ecx) (parse-var-with-type %ecx *(ebp+8)) # => eax 89/<- %edx 0/r32/eax @@ -2872,7 +2872,7 @@ test-parse-mu-var-def: # setup (clear-stream _test-input-stream) (write _test-input-stream "n: int\n") # caller has consumed the 'var' - # var vars/ecx : (stack (addr var) 4) + # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top @@ -2904,7 +2904,7 @@ test-parse-mu-reg-var-def: # setup (clear-stream _test-input-stream) (write _test-input-stream "n/eax: int <- copy 0\n") # caller has consumed the 'var' - # var vars/ecx : (stack (addr var) 4) + # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top @@ -2928,16 +2928,16 @@ test-parse-mu-reg-var-def: 5d/pop-to-ebp c3/return -parse-mu-stmt: # line : (addr stream byte), vars : (addr stack (handle var)), fn : (handle function) -> result/eax : (handle stmt) +parse-mu-stmt: # line: (addr stream byte), vars: (addr stack (handle var)), fn: (handle function) -> result/eax: (handle stmt) # pseudocode: - # var name : slice + # var name: slice # result = allocate(Heap, Stmt-size) # if stmt-has-outputs?(line) # while true # name = next-word(line) # if (name == '<-') break # assert(is-identifier?(name)) - # var v : (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs + # var v: (handle var) = lookup-or-define-var(name, vars, fn) # regular stmts may define vars in fn outputs # result->outputs = append(result->outputs, v) # add-operation-and-inputs-to-stmt(result, line, vars) # @@ -2947,11 +2947,11 @@ parse-mu-stmt: # line : (addr stream byte), vars : (addr stack (handle var)), f # . save registers 51/push-ecx 57/push-edi - # var name/ecx : slice + # var name/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp - # result/edi : (handle stmt) + # result/edi: (handle stmt) (allocate Heap *Stmt-size) # => eax (zero-out %eax *Stmt-size) 89/<- %edi 0/r32/eax @@ -3010,7 +3010,7 @@ $parse-mu-stmt:abort: cd/syscall 0x80/imm8 # never gets here -add-operation-and-inputs-to-stmt: # stmt : (handle stmt), line : (addr stream byte) +add-operation-and-inputs-to-stmt: # stmt: (handle stmt), line: (addr stream byte) # pseudocode: # stmt->name = slice-to-string(next-word(line)) # while true @@ -3027,7 +3027,7 @@ add-operation-and-inputs-to-stmt: # stmt : (handle stmt), line : (addr stream b 57/push-edi # edi = stmt 8b/-> *(ebp+8) 7/r32/edi - # var name/ecx : slice + # var name/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -3079,13 +3079,13 @@ $add-operation-and-inputs-to-stmt:abort: cd/syscall 0x80/imm8 # never gets here -stmt-has-outputs?: # line : (addr stream byte) -> result/eax : boolean +stmt-has-outputs?: # line: (addr stream byte) -> result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/<- %ecx 4/r32/esp @@ -3127,7 +3127,7 @@ $stmt-has-outputs:end: # if 'name' starts with a digit, create a new literal var for it # otherwise return first 'name' from the top (back) of 'vars' and abort if not found -lookup-var-or-literal: # name: (addr slice), vars : (addr stack (handle var)) -> result/eax: (handle var) +lookup-var-or-literal: # name: (addr slice), vars: (addr stack (handle var)) -> result/eax: (handle var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3140,7 +3140,7 @@ lookup-var-or-literal: # name: (addr slice), vars : (addr stack (handle var)) - (slice-empty? %esi) # => eax 3d/compare-eax-and 0/imm32 0f 85/jump-if-!= $lookup-var-or-literal:abort/disp32 - # var ecx : byte = *name->start + # var ecx: byte = *name->start 8b/-> *esi 1/r32/ecx 8a/copy-byte *ecx 1/r32/CL 81 4/subop/and %ecx 0xff/imm32 @@ -3175,11 +3175,11 @@ $lookup-var-or-literal:abort: # never gets here # return first 'name' from the top (back) of 'vars' and abort if not found -lookup-var: # name: (addr slice), vars : (addr stack (handle var)) -> result/eax: (handle var) +lookup-var: # name: (addr slice), vars: (addr stack (handle var)) -> result/eax: (handle var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp - # var target/eax : (handle array byte) = slice-to-string(name) + # var target/eax: (handle array byte) = slice-to-string(name) (slice-to-string Heap *(ebp+8)) # => eax # (lookup-var-helper %eax *(ebp+0xc)) # => eax @@ -3204,12 +3204,12 @@ $lookup-var:abort: # never gets here # return first 'name' from the top (back) of 'vars', and 0/null if not found -lookup-var-helper: # name: (addr array byte), vars : (addr stack (handle var)) -> result/eax: (handle var) +lookup-var-helper: # name: (addr array byte), vars: (addr stack (handle var)) -> result/eax: (handle var) # pseudocode: - # var curr : (addr handle var) = &vars->data[vars->top - 4] + # var curr: (addr handle var) = &vars->data[vars->top - 4] # var min = vars->data # while curr >= min - # var v : (handle var) = *curr + # var v: (handle var) = *curr # if v->name == name # return v # return 0 @@ -3228,9 +3228,9 @@ lookup-var-helper: # name: (addr array byte), vars : (addr stack (handle var)) # if (vars->top > vars->length) abort 3b/compare 0/r32/eax *(esi+4) 0f 8f/jump-if-> $lookup-var-helper:error1/disp32 - # var min/edx : (addr handle var) = vars->data + # var min/edx: (addr handle var) = vars->data 8d/copy-address *(esi+8) 2/r32/edx - # var curr/ebx : (addr handle var) = &vars->data[vars->top - 4] + # var curr/ebx: (addr handle var) = &vars->data[vars->top - 4] 81 5/subop/subtract %ebx 4/imm32 8d/copy-address *(esi+ebx+8) 3/r32/ebx { @@ -3238,7 +3238,7 @@ lookup-var-helper: # name: (addr array byte), vars : (addr stack (handle var)) 39/compare %ebx 2/r32/edx b8/copy-to-eax 0/imm32 0f 82/jump-if-addr< break/disp32 - # var v/eax : (handle var) = *curr + # var v/eax: (handle var) = *curr 8b/-> *ebx 0/r32/eax # if (v->name == name) return v (string-equal? *eax *(ebp+8)) # Var-name @@ -3271,13 +3271,13 @@ $lookup-var-helper:error1: # never gets here # return first 'name' from the top (back) of 'vars' and create a new var for a fn output if not found -lookup-or-define-var: # name: (addr slice), vars : (addr stack (handle var)), fn : (handle function) -> result/eax: (handle var) +lookup-or-define-var: # name: (addr slice), vars: (addr stack (handle var)), fn: (handle function) -> result/eax: (handle var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var target/ecx : (handle array byte) = slice-to-string(name) + # var target/ecx: (handle array byte) = slice-to-string(name) (slice-to-string Heap *(ebp+8)) # => eax 89/<- %ecx 0/r32/eax # @@ -3302,20 +3302,20 @@ $lookup-or-define-var:end: 5d/pop-to-ebp c3/return -find-in-function-outputs: # fn : (handle function), name : (handle array byte) => result/eax : (handle var) +find-in-function-outputs: # fn: (handle function), name: (handle array byte) => result/eax: (handle var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var curr/ecx : (handle list var) = fn->outputs + # var curr/ecx: (handle list var) = fn->outputs 8b/-> *(ebp+8) 1/r32/ecx 8b/-> *(ecx+0xc) 1/r32/ecx # while curr != null { 81 7/subop/compare %ecx 0/imm32 74/jump-if-= break/disp8 - # var v : (handle var) = *curr + # var v: (handle var) = *curr 8b/-> *ecx 0/r32/eax # List-value # if (curr->name == name) return curr 50/push-eax @@ -3344,13 +3344,13 @@ test-parse-mu-stmt: # setup (clear-stream _test-input-stream) (write _test-input-stream "increment n\n") - # var vars/ecx : (stack (addr var) 4) + # var vars/ecx: (stack (addr var) 4) 81 5/subop/subtract %esp 0x10/imm32 68/push 0x10/imm32/length 68/push 0/imm32/top 89/<- %ecx 4/r32/esp (clear-stack %ecx) - # var v/edx : var + # var v/edx: var 81 5/subop/subtract %esp 0x14/imm32 # Var-size 89/<- %edx 4/r32/esp (zero-out %edx 0x14) @@ -3363,9 +3363,9 @@ test-parse-mu-stmt: # check result (check-ints-equal *eax 1 "F - test-parse-mu-stmt/tag") # Stmt-tag is Stmt1 (check-strings-equal *(eax+4) "increment" "F - test-parse-mu-stmt/name") # Stmt1-operation - # edx : (handle list var) = result->inouts + # edx: (handle list var) = result->inouts 8b/-> *(eax+8) 2/r32/edx # Stmt1-inouts - # ebx : (handle var) = result->inouts->value + # ebx: (handle var) = result->inouts->value 8b/-> *edx 3/r32/ebx # List-value (check-strings-equal *ebx "n" "F - test-parse-mu-stmt/inout:0") # Var-name # . epilogue @@ -3437,7 +3437,7 @@ new-literal-integer: # ad: (addr allocation-descriptor), name: (addr slice) -> (is-hex-int? *(ebp+0xc)) # => eax 3d/compare-eax-and 0/imm32 0f 84/jump-if-= $new-literal-integer:abort/disp32 - # var s/ecx : (addr array byte) + # var s/ecx: (addr array byte) (slice-to-string Heap *(ebp+0xc)) # => eax 89/<- %ecx 0/r32/eax # @@ -3552,7 +3552,7 @@ $new-named-block:end: 5d/pop-to-ebp c3/return -new-list: # ad: (addr allocation-descriptor), value: _type, next: (handle list _type) -> result/eax : (handle list _type) +new-list: # ad: (addr allocation-descriptor), value: _type, next: (handle list _type) -> result/eax: (handle list _type) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3572,7 +3572,7 @@ $new-list:end: 5d/pop-to-ebp c3/return -append-list: # ad: (addr allocation-descriptor), value: _type, list: (handle list _type) -> result/eax : (handle list _type) +append-list: # ad: (addr allocation-descriptor), value: _type, list: (handle list _type) -> result/eax: (handle list _type) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3641,7 +3641,7 @@ $check-mu-types:end: 5d/pop-to-ebp c3/return -size-of: # n : (addr var) +size-of: # n: (addr var) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3657,7 +3657,7 @@ $size-of:end: # Code-generation ####################################################### -emit-subx: # out : (addr buffered-file) +emit-subx: # out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3667,7 +3667,7 @@ emit-subx: # out : (addr buffered-file) 57/push-edi # edi = out 8b/-> *(ebp+8) 7/r32/edi - # var curr/ecx : (handle function) = *Program + # var curr/ecx: (handle function) = *Program 8b/-> *Program 1/r32/ecx { # if (curr == null) break @@ -3688,7 +3688,7 @@ $emit-subx:end: 5d/pop-to-ebp c3/return -emit-subx-function: # out : (addr buffered-file), f : (handle function) +emit-subx-function: # out: (addr buffered-file), f: (handle function) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -3716,14 +3716,14 @@ $emit-subx-function:end: 5d/pop-to-ebp c3/return -emit-subx-block: # out : (addr buffered-file), block : (handle block) +emit-subx-block: # out: (addr buffered-file), block: (handle block) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 50/push-eax 56/push-esi - # var stmts/esi : (handle list statement) = block->statements + # var stmts/esi: (handle list statement) = block->statements 8b/-> *(ebp+0xc) 6/r32/esi 8b/-> *(esi+4) 6/r32/esi # Block-statements # @@ -3788,7 +3788,7 @@ $emit-subx-block:end: 5d/pop-to-ebp c3/return -emit-subx-statement: # out : (addr buffered-file), stmt : (handle statement), primitives : (handle primitive), functions : (handle function) +emit-subx-statement: # out: (addr buffered-file), stmt: (handle statement), primitives: (handle primitive), functions: (handle function) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4591,7 +4591,7 @@ Type-literal: 0/imm32/right/null == code -emit-subx-primitive: # out : (addr buffered-file), stmt : (handle statement), primitive : (handle function) +emit-subx-primitive: # out: (addr buffered-file), stmt: (handle statement), primitive: (handle function) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4617,7 +4617,7 @@ $emit-subx-primitive:end: 5d/pop-to-ebp c3/return -emit-subx-rm32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement) +emit-subx-rm32: # out: (addr buffered-file), l: arg-location, stmt: (handle statement) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4637,7 +4637,7 @@ $emit-subx-rm32:end: 5d/pop-to-ebp c3/return -get-stmt-operand-from-arg-location: # stmt : (handle statement), l : arg-location -> var/eax : (handle variable) +get-stmt-operand-from-arg-location: # stmt: (handle statement), l: arg-location -> var/eax: (handle variable) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4697,7 +4697,7 @@ $get-stmt-operand-from-arg-location:abort: cd/syscall 0x80/imm8 # never gets here -emit-subx-r32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement) +emit-subx-r32: # out: (addr buffered-file), l: arg-location, stmt: (handle statement) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4709,7 +4709,7 @@ emit-subx-r32: # out : (addr buffered-file), l : arg-location, stmt : (handle s 0f 84/jump-if-= $emit-subx-r32:end/disp32 # (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc)) # stmt, l => var/eax - (maybe-get Registers *(eax+0x10) 8) # Var-register => eax : (addr register-index) + (maybe-get Registers *(eax+0x10) 8) # Var-register => eax: (addr register-index) (write-buffered *(ebp+8) Space) (print-int32-buffered *(ebp+8) *eax) (write-buffered *(ebp+8) "/r32") @@ -4722,7 +4722,7 @@ $emit-subx-r32:end: 5d/pop-to-ebp c3/return -emit-subx-imm32: # out : (addr buffered-file), l : arg-location, stmt : (handle statement) +emit-subx-imm32: # out: (addr buffered-file), l: arg-location, stmt: (handle statement) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4746,7 +4746,7 @@ $emit-subx-imm32:end: 5d/pop-to-ebp c3/return -emit-subx-call: # out : (addr buffered-file), stmt : (handle statement), callee : (handle function) +emit-subx-call: # out: (addr buffered-file), stmt: (handle statement), callee: (handle function) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4759,7 +4759,7 @@ emit-subx-call: # out : (addr buffered-file), stmt : (handle statement), callee 8b/-> *(ebp+0x10) 1/r32/ecx (write-buffered *(ebp+8) *(ecx+4)) # Function-subx-name # - emit arguments - # var curr/ecx : (handle list var) = stmt->inouts + # var curr/ecx: (handle list var) = stmt->inouts 8b/-> *(ebp+0xc) 1/r32/ecx 8b/-> *(ecx+8) 1/r32/ecx # Stmt1-inouts { @@ -4783,7 +4783,7 @@ $emit-subx-call:end: 5d/pop-to-ebp c3/return -emit-subx-call-operand: # out : (addr buffered-file), operand : (handle variable) +emit-subx-call-operand: # out: (addr buffered-file), operand: (handle variable) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4831,7 +4831,7 @@ $emit-subx-call-operand:end: 5d/pop-to-ebp c3/return -emit-subx-var-as-rm32: # out : (addr buffered-file), operand : (handle variable) +emit-subx-var-as-rm32: # out: (addr buffered-file), operand: (handle variable) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4866,13 +4866,13 @@ $emit-subx-var-as-rm32:end: 5d/pop-to-ebp c3/return -find-matching-function: # functions : (addr function), stmt : (handle statement) -> result/eax : (handle function) +find-matching-function: # functions: (addr function), stmt: (handle statement) -> result/eax: (handle function) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var curr/ecx : (handle function) = functions + # var curr/ecx: (handle function) = functions 8b/-> *(ebp+8) 1/r32/ecx { # if (curr == null) break @@ -4900,13 +4900,13 @@ $find-matching-function:end: 5d/pop-to-ebp c3/return -find-matching-primitive: # primitives : (handle primitive), stmt : (handle statement) -> result/eax : (handle primitive) +find-matching-primitive: # primitives: (handle primitive), stmt: (handle statement) -> result/eax: (handle primitive) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var curr/ecx : (handle primitive) = primitives + # var curr/ecx: (handle primitive) = primitives 8b/-> *(ebp+8) 1/r32/ecx { $find-matching-primitive:loop: @@ -4942,7 +4942,7 @@ $find-matching-primitive:end: 5d/pop-to-ebp c3/return -mu-stmt-matches-function?: # stmt : (handle statement), function : (handle function) => result/eax : boolean +mu-stmt-matches-function?: # stmt: (handle statement), function: (handle function) => result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -4960,7 +4960,7 @@ $mu-stmt-matches-function?:end: 5d/pop-to-ebp c3/return -mu-stmt-matches-primitive?: # stmt : (handle statement), primitive : (handle primitive) => result/eax : boolean +mu-stmt-matches-primitive?: # stmt: (handle statement), primitive: (handle primitive) => result/eax: boolean # A mu stmt matches a primitive if the name matches, all the inout vars # match, and all the output vars match. # Vars match if types match and registers match. @@ -5086,7 +5086,7 @@ $mu-stmt-matches-primitive?:end: 5d/pop-to-ebp c3/return -operand-matches-primitive?: # var : (handle var), prim-var : (handle var) => result/eax : boolean +operand-matches-primitive?: # var: (handle var), prim-var: (handle var) => result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -5135,7 +5135,7 @@ $operand-matches-primitive?:end: 5d/pop-to-ebp c3/return -type-equal?: # a : (handle tree type-id), b : (handle tree type-id) => result/eax : boolean +type-equal?: # a: (handle tree type-id), b: (handle tree type-id) => result/eax: boolean # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -5198,29 +5198,29 @@ test-emit-subx-statement-primitive: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var + # var var-foo/ecx: var 68/push 0/imm32/no-register 68/push -8/imm32/stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var operand/ebx : (list var) + # var operand/ebx: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %ebx 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 53/push-ebx/operands 68/push "increment"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var primitives/ebx : primitive + # var primitives/ebx: primitive 68/push 0/imm32/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5271,40 +5271,40 @@ test-emit-subx-statement-primitive-register: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var in eax + # var var-foo/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var operand/ebx : (list var) + # var operand/ebx: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %ebx 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 53/push-ebx/outputs 68/push 0/imm32/inouts 68/push "increment"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var formal-var/ebx : var in any register + # var formal-var/ebx: var in any register 68/push Any-register/imm32 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "dummy"/imm32 89/<- %ebx 4/r32/esp - # var operand/ebx : (list var) + # var operand/ebx: (list var) 68/push 0/imm32/next 53/push-ebx/formal-var 89/<- %ebx 4/r32/esp - # var primitives/ebx : primitive + # var primitives/ebx: primitive 68/push 0/imm32/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5358,40 +5358,40 @@ test-emit-subx-statement-select-primitive: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var in eax + # var var-foo/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var real-outputs/edi : (list var) + # var real-outputs/edi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 68/push 0/imm32/inouts 68/push "increment"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var formal-var/ebx : var in any register + # var formal-var/ebx: var in any register 68/push Any-register/imm32 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "dummy"/imm32 89/<- %ebx 4/r32/esp - # var formal-outputs/ebx : (list var) = {formal-var, 0} + # var formal-outputs/ebx: (list var) = {formal-var, 0} 68/push 0/imm32/next 53/push-ebx/formal-var 89/<- %ebx 4/r32/esp - # var primitive1/ebx : primitive + # var primitive1/ebx: primitive 68/push 0/imm32/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5402,7 +5402,7 @@ test-emit-subx-statement-select-primitive: 68/push 0/imm32/inouts 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp - # var primitives/ebx : primitive + # var primitives/ebx: primitive 53/push-ebx/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5456,40 +5456,40 @@ test-emit-subx-statement-select-primitive-2: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var in eax + # var var-foo/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var inouts/edi : (list var) + # var inouts/edi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 57/push-edi/inouts 68/push "increment"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var formal-var/ebx : var in any register + # var formal-var/ebx: var in any register 68/push Any-register/imm32 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "dummy"/imm32 89/<- %ebx 4/r32/esp - # var operand/ebx : (list var) + # var operand/ebx: (list var) 68/push 0/imm32/next 53/push-ebx/formal-var 89/<- %ebx 4/r32/esp - # var primitive1/ebx : primitive + # var primitive1/ebx: primitive 68/push 0/imm32/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5500,7 +5500,7 @@ test-emit-subx-statement-select-primitive-2: 68/push 0/imm32/inouts 68/push "increment"/imm32/name 89/<- %ebx 4/r32/esp - # var primitives/ebx : primitive + # var primitives/ebx: primitive 53/push-ebx/next 68/push 0/imm32/output-is-write-only 68/push 0/imm32/no-imm32 @@ -5548,22 +5548,22 @@ test-increment-register: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var in eax + # var var-foo/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var real-outputs/edi : (list var) + # var real-outputs/edi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 68/push 0/imm32/inouts @@ -5607,22 +5607,22 @@ test-increment-var: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var in eax + # var var-foo/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var inouts/edi : (list var) + # var inouts/edi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 57/push-edi/inouts @@ -5656,33 +5656,33 @@ test-add-reg-to-reg: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var in eax + # var var-var1/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var var-var2/edx : var in ecx + # var var-var2/edx: var in ecx 68/push "ecx"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "var2"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp - # var outputs/edi : (list var1) + # var outputs/edi: (list var1) 68/push 0/imm32/next 51/push-ecx/var-var1 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 56/push-esi/inouts @@ -5716,25 +5716,25 @@ test-add-reg-to-mem: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var + # var var-var1/ecx: var 68/push 0/imm32/no-register 68/push 8/imm32/stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var var-var2/edx : var in ecx + # var var-var2/edx: var in ecx 68/push "ecx"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "var2"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp @@ -5742,7 +5742,7 @@ test-add-reg-to-mem: 56/push-esi/next 51/push-ecx/var-var1 89/<- %esi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 56/push-esi/inouts @@ -5776,33 +5776,33 @@ test-add-mem-to-reg: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var in eax + # var var-var1/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var var-var2/edx : var + # var var-var2/edx: var 68/push 0/imm32/no-register 68/push 8/imm32/stack-offset 68/push 1/imm32/block-depth ff 6/subop/push *(ecx+4) # Var-type 68/push "var2"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp - # var outputs/edi : (list var1) + # var outputs/edi: (list var1) 68/push 0/imm32/next 51/push-ecx/var-var1 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 56/push-esi/inouts @@ -5836,37 +5836,37 @@ test-add-literal-to-eax: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var in eax + # var var-var1/ecx: var in eax 68/push "eax"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var type/edx : (handle tree type-id) = literal + # var type/edx: (handle tree type-id) = literal 68/push 0/imm32/right/null 68/push 0/imm32/left/literal 89/<- %edx 4/r32/esp - # var var-var2/edx : var literal + # var var-var2/edx: var literal 68/push 0/imm32/no-register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 52/push-edx 68/push "0x34"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp - # var outputs/edi : (list var1) + # var outputs/edi: (list var1) 68/push 0/imm32/next 51/push-ecx/var-var1 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 56/push-esi/inouts @@ -5900,37 +5900,37 @@ test-add-literal-to-reg: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var in ecx + # var var-var1/ecx: var in ecx 68/push "ecx"/imm32/register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var type/edx : (handle tree type-id) = literal + # var type/edx: (handle tree type-id) = literal 68/push 0/imm32/right/null 68/push 0/imm32/left/literal 89/<- %edx 4/r32/esp - # var var-var2/edx : var literal + # var var-var2/edx: var literal 68/push 0/imm32/no-register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 52/push-edx 68/push "0x34"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp - # var outputs/edi : (list var1) + # var outputs/edi: (list var1) 68/push 0/imm32/next 51/push-ecx/var-var1 89/<- %edi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 57/push-edi/outputs 56/push-esi/inouts @@ -5964,29 +5964,29 @@ test-add-literal-to-mem: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-var1/ecx : var + # var var-var1/ecx: var 68/push 0/imm32/no-register 68/push 8/imm32/stack-offset 68/push 1/imm32/block-depth 51/push-ecx 68/push "var1"/imm32 89/<- %ecx 4/r32/esp - # var type/edx : (handle tree type-id) = literal + # var type/edx: (handle tree type-id) = literal 68/push 0/imm32/right/null 68/push 0/imm32/left/literal 89/<- %edx 4/r32/esp - # var var-var2/edx : var literal + # var var-var2/edx: var literal 68/push 0/imm32/no-register 68/push 0/imm32/no-stack-offset 68/push 1/imm32/block-depth 52/push-edx 68/push "0x34"/imm32 89/<- %edx 4/r32/esp - # var inouts/esi : (list var2) + # var inouts/esi: (list var2) 68/push 0/imm32/next 52/push-edx/var-var2 89/<- %esi 4/r32/esp @@ -5994,7 +5994,7 @@ test-add-literal-to-mem: 56/push-esi/next 51/push-ecx/var-var1 89/<- %esi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 56/push-esi/inouts @@ -6043,29 +6043,29 @@ test-emit-subx-statement-function-call: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = int + # var type/ecx: (handle tree type-id) = int 68/push 0/imm32/right/null 68/push 1/imm32/left/int 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var + # var var-foo/ecx: var 68/push 0/imm32/no-register 68/push -8/imm32/stack-offset 68/push 0/imm32/block-depth 51/push-ecx 68/push "foo"/imm32 89/<- %ecx 4/r32/esp - # var operands/esi : (list var) + # var operands/esi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %esi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 56/push-esi/inouts 68/push "f"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var functions/ebx : function + # var functions/ebx: function 68/push 0/imm32/next 68/push 0/imm32/body 68/push 0/imm32/outputs @@ -6101,29 +6101,29 @@ test-emit-subx-statement-function-call-with-literal-arg: # setup (clear-stream _test-output-stream) (clear-stream $_test-output-buffered-file->buffer) - # var type/ecx : (handle tree type-id) = literal + # var type/ecx: (handle tree type-id) = literal 68/push 0/imm32/right/null 68/push 0/imm32/left/literal 89/<- %ecx 4/r32/esp - # var var-foo/ecx : var literal + # var var-foo/ecx: var literal 68/push 0/imm32/no-register 68/push 0/imm32/no-stack-offset 68/push 0/imm32/block-depth 51/push-ecx 68/push "34"/imm32 89/<- %ecx 4/r32/esp - # var operands/esi : (list var) + # var operands/esi: (list var) 68/push 0/imm32/next 51/push-ecx/var-foo 89/<- %esi 4/r32/esp - # var stmt/esi : statement + # var stmt/esi: statement 68/push 0/imm32/next 68/push 0/imm32/outputs 56/push-esi/inouts 68/push "f"/imm32/operation 68/push 1/imm32 89/<- %esi 4/r32/esp - # var functions/ebx : function + # var functions/ebx: function 68/push 0/imm32/next 68/push 0/imm32/body 68/push 0/imm32/outputs @@ -6147,7 +6147,7 @@ test-emit-subx-statement-function-call-with-literal-arg: 5d/pop-to-ebp c3/return -emit-subx-prologue: # out : (addr buffered-file) +emit-subx-prologue: # out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -6161,7 +6161,7 @@ $emit-subx-prologue:end: 5d/pop-to-ebp c3/return -emit-subx-epilogue: # out : (addr buffered-file) +emit-subx-epilogue: # out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp diff --git a/apps/mulisp.subx b/apps/mulisp.subx index a2fd5ebe..c2834021 100644 --- a/apps/mulisp.subx +++ b/apps/mulisp.subx @@ -74,19 +74,19 @@ $main:end: # data contains a pointer to an array of 8-byte data fields and the common # tag for them all -repl: # in : (addr buffered-file), out : (addr buffered-file) +repl: # in: (addr buffered-file), out: (addr buffered-file) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 50/push-eax { - (lisp-read Stdin) # => eax : (handle cell) + (lisp-read Stdin) # => eax: (handle cell) # if (eax == 0) break 3d/compare-eax-and 0/imm32 74/jump-if-= break/disp8 # - (lisp-eval %eax) # => eax : (handle cell) + (lisp-eval %eax) # => eax: (handle cell) (lisp-print Stdout %eax) eb/jump loop/disp8 } @@ -104,13 +104,13 @@ $repl:end: # arrays start with '[' # symbols start with anything else but quote, backquote, unquote or splice # only one s-expression per line -lisp-read: # in : (addr buffered-file) -> eax : (handle cell) +lisp-read: # in: (addr buffered-file) -> eax: (handle cell) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp # . save registers 51/push-ecx - # var s/ecx : (stream byte 512) + # var s/ecx: (stream byte 512) 81 5/subop/subtract %esp 0x200/imm32 68/push 0x200/imm32/size 68/push 0/imm32/read @@ -142,14 +142,14 @@ $lisp-read:end: 5d/pop-to-ebp c3/return -# lisp-read: in : (addr buffered-file) -> (handle cell) +# lisp-read: in: (addr buffered-file) -> (handle cell) # token tmp = next-mulisp-token(in) # if is-int(tmp) return cell(tmp) # if is-string(tmp) return cell(tmp) # if is-pair(tmp) ... # if is-array(tmp) ... -next-mulisp-token: # in : (addr buffered-file), line : (addr stream byte), result : (addr slice) +next-mulisp-token: # in: (addr buffered-file), line: (addr stream byte), result: (addr slice) # pseudocode: # if (line->read >= line->write) # read-line-buffered(in, line) @@ -194,11 +194,11 @@ $next-mulisp-token:end: 5d/pop-to-ebp c3/return -new-int-cell: # in : (addr slice) -> eax : (handle cell) +new-int-cell: # in: (addr slice) -> eax: (handle cell) -new-string-cell: # in : (addr slice) -> eax : (handle cell) +new-string-cell: # in: (addr slice) -> eax: (handle cell) -lisp-eval: # in : (addr cell) -> eax : (handle cell) +lisp-eval: # in: (addr cell) -> eax: (handle cell) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp @@ -211,7 +211,7 @@ $lisp-eval:end: 5d/pop-to-ebp c3/return -lisp-print: # out : (addr buffered-file), x : (addr cell) +lisp-print: # out: (addr buffered-file), x: (addr cell) # . prologue 55/push-ebp 89/<- %ebp 4/r32/esp diff --git a/apps/pack.subx b/apps/pack.subx index 8719996b..f9f81127 100644 --- a/apps/pack.subx +++ b/apps/pack.subx @@ -55,7 +55,7 @@ Entry: # run tests if necessary, convert stdin if not eb/jump $subx-pack-main:end/disp8 $subx-pack-main:interactive: # - otherwise convert stdin - # var ed/eax : exit-descriptor + # var ed/eax: exit-descriptor 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # subtract from esp 89/copy 3/mod/direct 0/rm32/eax . . . 4/r32/esp . . # copy esp to eax # configure ed to really exit() @@ -97,9 +97,9 @@ $subx-pack-main:end: # next-token-from-slice(start, end, delim char) -> slice # slice-equal?(slice, string) -subx-pack: # in : (addr buffered-file), out : (addr buffered-file) +subx-pack: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var line : (stream byte 512) + # var line: (stream byte 512) # var in-code? = false # while true # clear-stream(line) @@ -128,17 +128,17 @@ subx-pack: # in : (addr buffered-file), out : (addr buffered-file) 51/push-ecx 52/push-edx 53/push-ebx - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx - # var in-code?/ebx : boolean = false + # var in-code?/ebx: boolean = false 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx $subx-pack:loop: # clear-stream(line) @@ -909,9 +909,9 @@ test-subx-pack-code-and-data-segments: 5d/pop-to-ebp c3/return -convert-data: # line : (addr stream byte), out : (addr buffered-file) +convert-data: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word(line) # if slice-empty?(word-slice) # end of file (maybe including trailing whitespace) @@ -936,7 +936,7 @@ convert-data: # line : (addr stream byte), out : (addr buffered-file) 50/push-eax 51/push-ecx 52/push-edx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -1029,9 +1029,9 @@ $convert-data:check0: 0f 85/jump-if-!= $convert-data:break/disp32 $convert-data:check-for-comment: # if (slice-starts-with?(word-slice, "#")) - # . var start/edx : (addr byte) = word-slice->start + # . var start/edx: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . if (c != '#') goto next check @@ -1050,9 +1050,9 @@ $convert-data:comment: 0f 85/jump-if-!= $convert-data:end/disp32 $convert-data:check-for-label: # if (slice-ends-with?(word-slice, ":")) - # . var end/edx : (addr byte) = word-slice->end + # . var end/edx: (addr byte) = word-slice->end 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx - # . var c/eax : byte = *(end-1) + # . var c/eax: byte = *(end-1) 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 0/r32/AL -1/disp8 . # copy byte at *ecx to AL # . if (c != ':') goto next check @@ -1809,7 +1809,7 @@ test-convert-data-trailing-comment: # unceremoniously abort on non-numeric operands except disp or imm # opcodes must be lowercase and zero padded # opcodes with misleading operand metadata may get duplicated as operands as well. don't rely on this. -convert-instruction: # line : (addr stream byte), out : (addr buffered-file) +convert-instruction: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: # # some early exits # var word-slice = next-word(line) @@ -1837,7 +1837,7 @@ convert-instruction: # line : (addr stream byte), out : (addr buffered-file) 50/push-eax 51/push-ecx 52/push-edx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -1863,9 +1863,9 @@ $convert-instruction:check0: 75/jump-if-!= $convert-instruction:pass-through/disp8 $convert-instruction:check1: # if (slice-starts-with?(word-slice, "#")) write-stream-data(out, line) - # . var start/edx : (addr byte) = word-slice->start + # . var start/edx: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . if (c == '#') pass through @@ -1873,9 +1873,9 @@ $convert-instruction:check1: 74/jump-if-= $convert-instruction:pass-through/disp8 $convert-instruction:check2: # if (slice-ends-with?(word-slice, ":")) write-stream-data(out, line) - # . var end/edx : (addr byte) = word-slice->end + # . var end/edx: (addr byte) = word-slice->end 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 . # copy *(ecx+4) to edx - # . var c/eax : byte = *(end-1) + # . var c/eax: byte = *(end-1) 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 0/r32/AL -1/disp8 . # copy byte at *ecx to AL # . if (c == ':') pass through @@ -1953,7 +1953,7 @@ $convert-instruction:end: 5d/pop-to-ebp c3/return -emit-opcodes: # line : (addr stream byte), out : (addr buffered-file) +emit-opcodes: # line: (addr stream byte), out: (addr buffered-file) # opcodes occupy 1-3 bytes: # xx # 0f xx @@ -1994,11 +1994,11 @@ emit-opcodes: # line : (addr stream byte), out : (addr buffered-file) 51/push-ecx 52/push-edx 53/push-ebx - # var op1/ecx : slice + # var op1/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var op2/edx : slice + # var op2/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -2030,9 +2030,9 @@ $emit-opcodes:op1: 3d/compare-eax-and 0/imm32/false 0f 85/jump-if-!= $emit-opcodes:end/disp32 # if (slice-starts-with?(op1, "#")) return - # . var start/ebx : (addr byte) = op1->start + # . var start/ebx: (addr byte) = op1->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 3/r32/ebx . . # copy *ecx to ebx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 3/rm32/ebx . . . 0/r32/AL . . # copy byte at *ebx to AL # . if (c == '#') return @@ -2123,9 +2123,9 @@ $emit-opcodes:op2: 3d/compare-eax-and 0/imm32/false 0f 85/jump-if-!= $emit-opcodes:end/disp32 # if (slice-starts-with?(op2, "#")) return - # . var start/ebx : (addr byte) = op2->start + # . var start/ebx: (addr byte) = op2->start 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . . # copy *edx to ebx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 3/rm32/ebx . . . 0/r32/AL . . # copy byte at *ebx to AL # . if (c == '#') return @@ -2202,9 +2202,9 @@ $emit-opcodes:op3: 3d/compare-eax-and 0/imm32/false 0f 85/jump-if-!= $emit-opcodes:end/disp32 # if (slice-starts-with?(op3, "#")) return - # . var start/ebx : (addr byte) = op2->start + # . var start/ebx: (addr byte) = op2->start 8b/copy 0/mod/indirect 2/rm32/edx . . . 3/r32/ebx . . # copy *edx to ebx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 3/rm32/ebx . . . 0/r32/AL . . # copy byte at *ebx to AL # . if (c == '#') return @@ -2249,11 +2249,11 @@ $emit-opcodes:end: 5d/pop-to-ebp c3/return -emit-modrm: # line : (addr stream byte), out : (addr buffered-file) +emit-modrm: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: # rewind-stream(line) # var has-modrm? = false, mod = 0, rm32 = 0, r32 = 0 - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word(line) # if (slice-empty?(word-slice)) break @@ -2285,17 +2285,17 @@ emit-modrm: # line : (addr stream byte), out : (addr buffered-file) 53/push-ebx 56/push-esi 57/push-edi - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var has-modrm?/edx : boolean = false + # var has-modrm?/edx: boolean = false 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx - # var mod/ebx : byte = 0 + # var mod/ebx: byte = 0 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx - # var rm32/esi : byte = 0 + # var rm32/esi: byte = 0 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . . # clear esi - # var r32/edi : byte = 0 + # var r32/edi: byte = 0 31/xor 3/mod/direct 7/rm32/edi . . . 7/r32/edi . . # clear edi # rewind-stream(line) # . . push args @@ -2402,9 +2402,9 @@ $emit-modrm:check1: # if (slice-starts-with?(word-slice, "#")) break # . spill edx 52/push-edx - # . var start/edx : (addr byte) = word-slice->start + # . var start/edx: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . restore edx @@ -2529,7 +2529,7 @@ $emit-modrm:break: 81 7/subop/compare 3/mod/direct 2/rm32/edx . . . . . 0/imm32/false # compare edx 74/jump-if-= $emit-modrm:end/disp8 $emit-modrm:calculate: - # var modrm/ebx : byte = mod & 0b11 + # var modrm/ebx: byte = mod & 0b11 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 3/imm32/0b11 # bitwise and of ebx # modrm <<= 3 c1/shift 4/subop/left 3/mod/direct 3/rm32/ebx . . . . . 3/imm8 # shift ebx left by 3 bits @@ -2566,10 +2566,10 @@ $emit-modrm:end: 5d/pop-to-ebp c3/return -emit-sib: # line : (addr stream byte), out : (addr buffered-file) +emit-sib: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: # var has-sib? = false, base = 0, index = 0, scale = 0 - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word(line) # if (slice-empty?(word-slice)) break @@ -2601,17 +2601,17 @@ emit-sib: # line : (addr stream byte), out : (addr buffered-file) 53/push-ebx 56/push-esi 57/push-edi - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var has-sib?/edx : boolean = false + # var has-sib?/edx: boolean = false 31/xor 3/mod/direct 2/rm32/edx . . . 2/r32/edx . . # clear edx - # var scale/ebx : byte = 0 + # var scale/ebx: byte = 0 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . . # clear ebx - # var base/esi : byte = 0 + # var base/esi: byte = 0 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . . # clear esi - # var index/edi : byte = 0 + # var index/edi: byte = 0 31/xor 3/mod/direct 7/rm32/edi . . . 7/r32/edi . . # clear edi # rewind-stream(line) # . . push args @@ -2711,9 +2711,9 @@ $emit-sib:check1: # if (slice-starts-with?(word-slice, "#")) break # . spill edx 52/push-edx - # . var start/edx : (addr byte) = word-slice->start + # . var start/edx: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . restore edx @@ -2810,7 +2810,7 @@ $emit-sib:break: 81 7/subop/compare 3/mod/direct 2/rm32/edx . . . . . 0/imm32/false # compare edx 74/jump-if-= $emit-sib:end/disp8 $emit-sib:calculate: - # var sib/ebx : byte = scale & 0b11 + # var sib/ebx: byte = scale & 0b11 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 3/imm32/0b11 # bitwise and of ebx # sib <<= 2 c1/shift 4/subop/left 3/mod/direct 3/rm32/ebx . . . . . 2/imm8 # shift ebx left by 2 bits @@ -2847,10 +2847,10 @@ $emit-sib:end: 5d/pop-to-ebp c3/return -emit-disp: # line : (addr stream byte), out : (addr buffered-file) +emit-disp: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: # rewind-stream(line) - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word(line) # if (slice-empty?(word-slice)) break @@ -2872,7 +2872,7 @@ emit-disp: # line : (addr stream byte), out : (addr buffered-file) 50/push-eax 51/push-ecx 52/push-edx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2972,9 +2972,9 @@ $emit-disp:check0: 0f 85/jump-if-!= $emit-disp:break/disp32 $emit-disp:check1: # if (slice-starts-with?(word-slice, "#")) break - # . var start/edx : (addr byte) = word-slice->start + # . var start/edx: (addr byte) = word-slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . if (c == '#') break @@ -3066,10 +3066,10 @@ $emit-disp:break: 5d/pop-to-ebp c3/return -emit-imm: # line : (addr stream byte), out : (addr buffered-file) +emit-imm: # line: (addr stream byte), out: (addr buffered-file) # pseudocode: # rewind-stream(line) - # var word-slice : slice + # var word-slice: slice # while true # word-slice = next-word(line) # if (slice-empty?(word-slice)) break @@ -3091,7 +3091,7 @@ emit-imm: # line : (addr stream byte), out : (addr buffered-file) 50/push-eax 51/push-ecx 52/push-edx - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -3191,9 +3191,9 @@ $emit-imm:check0: 0f 85/jump-if-!= $emit-imm:break/disp32 $emit-imm:check1: # if (slice-starts-with?(word-slice, "#")) break - # . var start/edx : (addr byte) = slice->start + # . var start/edx: (addr byte) = slice->start 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . . # copy *ecx to edx - # . var c/eax : byte = *start + # . var c/eax: byte = *start 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 0/r32/AL . . # copy byte at *edx to AL # . if (c == '#') break @@ -3285,7 +3285,7 @@ $emit-imm:break: 5d/pop-to-ebp c3/return -emit-line-in-comment: # line : (addr stream byte), out : (addr buffered-file) +emit-line-in-comment: # line: (addr stream byte), out: (addr buffered-file) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -5837,7 +5837,7 @@ test-convert-instruction-handles-imm8-operand: c3/return # shortcut for parse-hex-int(next-token-from-slice(word->start, word->end, '/')) -parse-datum-of-word: # word : (addr slice) -> value/eax : int +parse-datum-of-word: # word: (addr slice) -> value/eax: int # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -5846,7 +5846,7 @@ parse-datum-of-word: # word : (addr slice) -> value/eax : int 56/push-esi # esi = word 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx diff --git a/apps/sigils.subx b/apps/sigils.subx index fd0bc649..ab922eda 100644 --- a/apps/sigils.subx +++ b/apps/sigils.subx @@ -104,9 +104,9 @@ $subx-sigils-main:end: # error messages considered: # *x + 34 -> error: base+disp addressing must be within '()' -subx-sigils: # in : (addr buffered-file), out : (addr buffered-file) +subx-sigils: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode: - # var line : (stream byte 512) + # var line: (stream byte 512) # while true # clear-stream(line) # read-line-buffered(in, line) @@ -141,13 +141,13 @@ subx-sigils: # in : (addr buffered-file), out : (addr buffered-file) 51/push-ecx 52/push-edx 53/push-ebx - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -1359,13 +1359,13 @@ test-subx-sigils-indirect-mode-without-register: 5d/pop-to-ebp c3/return -emit-direct-mode: # out : (addr buffered-file), word-slice : (addr slice) +emit-direct-mode: # out: (addr buffered-file), word-slice: (addr slice) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 50/push-eax - # var local-slice/eax : slice = {word-slice->start, word-slice->end} + # var local-slice/eax: slice = {word-slice->start, word-slice->end} 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0xc/disp8 . # copy *(ebp+12) to eax ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 . # push *(eax+4) ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . . # push *eax @@ -1599,7 +1599,7 @@ test-emit-direct-mode-2: # error messages considered: # * ... -> error: no space after '*' # *(... -> error: *(...) expression must be all on a single line -next-word-or-expression: # line : (addr stream byte), out : (addr slice) +next-word-or-expression: # line: (addr stream byte), out: (addr slice) # pseudocode: # skip-chars-matching(line, ' ') # if line->read >= line->write # end of line @@ -1834,7 +1834,7 @@ test-next-word-or-expression: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -1907,7 +1907,7 @@ test-next-word-or-expression-returns-whole-comment: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -1980,7 +1980,7 @@ test-next-word-or-expression-returns-empty-slice-on-eof: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2022,7 +2022,7 @@ test-next-word-or-expression-returns-string-literal: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2085,7 +2085,7 @@ test-next-word-or-expression-returns-string-with-escapes: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2148,7 +2148,7 @@ test-next-word-or-expression-returns-whole-expression: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var slice/ecx : slice + # var slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx @@ -2207,7 +2207,7 @@ test-next-word-or-expression-returns-whole-expression: # *(reg1+reg2<<s+disp) -> 2/mod 4/rm32 reg1/base reg2/index s/scale disp/disp32 # Intermediate structure: base, index, scale, disp # Default values: base: 0, index: 4 (none), scale: 0, disp: 0 -parse-effective-address: # word-slice : (addr slice) -> base/eax, index/ecx, scale/edx, disp/ebx +parse-effective-address: # word-slice: (addr slice) -> base/eax, index/ecx, scale/edx, disp/ebx # pseudocode: # var local-slice = {word-slice->start, word-slice->end} # ++local-slice->start to skip '*' @@ -2250,7 +2250,7 @@ parse-effective-address: # word-slice : (addr slice) -> base/eax, index/ecx, sc # . save registers 56/push-esi 57/push-edi - # var local-slice/esi : slice = {word-slice->start, word-slice->end} + # var local-slice/esi: slice = {word-slice->start, word-slice->end} 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4) ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi @@ -2670,7 +2670,7 @@ $parse-effective-address:error4: # assumes 'in' starts with a register name, and returns pointer to its code # side-effect: modifies 'in' to scan past the initial register name -next-register: # in : (addr slice) -> reg/eax : int +next-register: # in: (addr slice) -> reg/eax: int # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -2679,7 +2679,7 @@ next-register: # in : (addr slice) -> reg/eax : int 56/push-esi # esi = in 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi - # var reg-slice/ecx : slice = {in->start, in->start + 3} + # var reg-slice/ecx: slice = {in->start, in->start + 3} 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . . # copy *esi to eax 05/add-to-eax 3/imm32 50/push-eax @@ -3149,7 +3149,7 @@ test-parse-effective-address-base-index-scale-displacement: # if index is none, then mod = 2 and rm32 = base and disp32 = disp # emit-sib: # if index is not none, then mod = 2 and rm32 = 4 and base = base and index = index and disp32 = disp -emit-indirect-mode: # out : (addr buffered-file), base : int, index : int, scale : int, disp : int +emit-indirect-mode: # out: (addr buffered-file), base: int, index: int, scale: int, disp: int # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3858,14 +3858,14 @@ test-emit-indirect-mode-esp: 5d/pop-to-ebp c3/return -disp32-mode?: # in : (addr slice) -> reg/eax : boolean +disp32-mode?: # in: (addr slice) -> reg/eax: boolean # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 56/push-esi 57/push-edi - # var local-slice/esi : slice = {in->start, in->end} + # var local-slice/esi: slice = {in->start, in->end} 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 . # copy *(ebp+8) to esi ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4) ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi @@ -3917,13 +3917,13 @@ $disp32-mode?:end: 5d/pop-to-ebp c3/return -emit-indirect-disp32: # out : (addr buffered-file), word-slice : (addr slice) +emit-indirect-disp32: # out: (addr buffered-file), word-slice: (addr slice) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # . save registers 56/push-esi - # var local-slice/esi : slice = {in->start, in->end} + # var local-slice/esi: slice = {in->start, in->end} 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 . # copy *(ebp+12) to esi ff 6/subop/push 1/mod/*+disp8 6/rm32/esi . . . . 4/disp8 . # push *(esi+4) ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . . # push *esi @@ -3967,7 +3967,7 @@ $emit-indirect-disp32:end: # assumes 'in' starts with optional '+' or '-', optional whitespace, and an unsigned integer # returns the value of the integer # side-effect: modifies 'in' to skip past the integer -next-hex-int: # in : (addr slice) -> result/eax +next-hex-int: # in: (addr slice) -> result/eax # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -4382,7 +4382,7 @@ test-next-hex-int-negative-with-space: # assumes 'in' starts a positive unsigned integer # returns the value of the integer # side-effect: modifies 'in' to skip past the integer -next-positive-hex-int: # in : (addr slice) -> result/eax +next-positive-hex-int: # in: (addr slice) -> result/eax # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp diff --git a/apps/survey.subx b/apps/survey.subx index 7ee97d3d..d996ba96 100644 --- a/apps/survey.subx +++ b/apps/survey.subx @@ -113,12 +113,12 @@ $subx-survey-main:end: # labels: (addr stream {string, label-info}) (16 bytes per row) # these are all inefficient; use sequential scans for lookups -subx-survey: # infile : (addr buffered-file), out : (addr buffered-file) +subx-survey: # infile: (addr buffered-file), out: (addr buffered-file) # pseudocode - # var in : (stream byte 4096) + # var in: (stream byte 4096) # slurp(infile, in) - # var segments : (stream segment-info) - # var labels : (stream label-info Max-labels) + # var segments: (stream segment-info) + # var labels: (stream label-info Max-labels) # compute-offsets(in, segments, labels) # compute-addresses(segments, labels) # rewind-stream(in) @@ -131,13 +131,13 @@ subx-survey: # infile : (addr buffered-file), out : (addr buffered-file) 51/push-ecx 52/push-edx 56/push-esi - # var segments/ecx : (stream {string, segment-info} 160) # 10 rows * 16 bytes/row + # var segments/ecx: (stream {string, segment-info} 160) # 10 rows * 16 bytes/row 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var labels/edx : (stream label-info Max-labels*16) + # var labels/edx: (stream label-info Max-labels*16) # . data 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32 # subtract *Max-labels from esp # . length @@ -147,7 +147,7 @@ subx-survey: # infile : (addr buffered-file), out : (addr buffered-file) # . write 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx - # var in/esi : (stream byte Input-size) + # var in/esi: (stream byte Input-size) # . data 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32 # subtract *Input-size from esp # . length @@ -618,7 +618,7 @@ compute-offsets:segment-tmp: # slice == code -compute-offsets: # in : (addr stream byte), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +compute-offsets: # in: (addr stream byte), segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # skeleton: # for lines in 'in' # for words in line @@ -629,8 +629,8 @@ compute-offsets: # in : (addr stream byte), segments : (addr stream {string, se # default # # pseudocode: - # curr-segment-name : (addr string) = 0 - # var line : (stream byte 512) + # curr-segment-name: (addr string) = 0 + # var line: (stream byte 512) # while true # line loop # clear-stream(line) # read-line(in, line) @@ -661,7 +661,7 @@ compute-offsets: # in : (addr stream byte), segments : (addr stream {string, se # break (next line) # else if is-label?(word-slice) # strip trailing ':' from word-slice - # x : (addr label-info) = get-or-insert(labels, name) + # x: (addr label-info) = get-or-insert(labels, name) # x->segment-name = curr-segment-name # trace("label '", word-slice, "' is in segment '", curr-segment-name, "'.") # x->segment-offset = segment-offset @@ -688,7 +688,7 @@ compute-offsets: # in : (addr stream byte), segments : (addr stream {string, se c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:file-offset/disp32 0/imm32 # copy to *compute-offsets:word-slice # segment-offset = 0 c7 0/subop/copy 0/mod/indirect 5/rm32/.disp32 . . . compute-offsets:segment-offset/disp32 0/imm32 # copy to *compute-offsets:word-slice - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read @@ -1219,13 +1219,13 @@ test-compute-offsets: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # var segments/ecx : (stream byte 2*16) + # var segments/ecx: (stream byte 2*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp 68/push 0x20/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var labels/edx : (stream byte 2*16) + # var labels/edx: (stream byte 2*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x20/imm32 # subtract from esp 68/push 0x20/imm32/length 68/push 0/imm32/read @@ -1378,9 +1378,9 @@ test-compute-offsets: 5d/pop-to-ebp c3/return -compute-addresses: # segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +compute-addresses: # segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # pseudocode: - # srow : (addr segment-info) = segments->data + # srow: (addr segment-info) = segments->data # max = &segments->data[segments->write] # num-segments = segments->write / 16 # starting-offset = 0x34 + (num-segments * 0x20) @@ -1391,12 +1391,12 @@ compute-addresses: # segments : (addr stream {string, segment-info}), labels : # s->address += (s->file-offset & 0x00000fff) # trace-sssns("segment " s->key " starts at address " s->address) # srow += 16 # row-size - # lrow : (addr label-info) = labels->data + # lrow: (addr label-info) = labels->data # max = &labels->data[labels->write] # while true # if (lrow >= max) break - # seg-name : (addr string) = lrow->segment-name - # label-seg : (addr segment-info) = get(segments, seg-name) + # var seg-name: (addr string) = lrow->segment-name + # var label-seg: (addr segment-info) = get(segments, seg-name) # lrow->address = label-seg->address + lrow->segment-offset # trace-sssns("label " lrow->key " is at address " lrow->address) # lrow += 16 # row-size @@ -1522,7 +1522,7 @@ $compute-addresses:label-loop: #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp #? # }}} - # seg-name/edx = lrow->segment-name + # var seg-name/edx: (addr array byte) = lrow->segment-name 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 2/r32/edx 4/disp8 . # copy *eax to edx #? # dump seg-name {{{ #? # . write(2/stderr, "compute-addresses: seg-name: ") @@ -1550,7 +1550,7 @@ $compute-addresses:label-loop: #? # . . discard args #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp #? # }}} - # label-seg/edx : (addr segment-info) = get(segments, seg-name, row-size=16, "segment table") + # var label-seg/edx: (addr segment-info) = get(segments, seg-name, row-size=16, "segment table") # . save eax 50/push-eax # . eax = get(segments, seg-name, row-size=16) @@ -1621,13 +1621,13 @@ test-compute-addresses: 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # setup - # . var segments/ecx : (stream byte 10*16) + # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # . var labels/edx : (stream byte 512*16) + # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp 68/push 0x2000/imm32/length 68/push 0/imm32/read @@ -1790,13 +1790,13 @@ test-compute-addresses-large-segments: 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # setup - # . var segments/ecx : (stream byte 10*16) + # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # . var labels/edx : (stream byte 512*16) + # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp 68/push 0x2000/imm32/length 68/push 0/imm32/read @@ -1871,7 +1871,7 @@ test-compute-addresses-large-segments: 5d/pop-to-ebp c3/return -emit-output: # in : (addr stream byte), out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +emit-output: # in: (addr stream byte), out: (addr buffered-file), segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # pseudocode: # emit-headers(out, segments, labels) # emit-segments(in, out, segments, labels) @@ -1922,10 +1922,10 @@ $emit-output:end: 5d/pop-to-ebp c3/return -emit-segments: # in : (addr stream byte), out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +emit-segments: # in: (addr stream byte), out: (addr buffered-file), segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # pseudocode: # var offset-of-next-instruction = 0 - # var line : (stream byte 512) + # var line: (stream byte 512) # line-loop: # while true # clear-stream(line) @@ -1987,17 +1987,17 @@ emit-segments: # in : (addr stream byte), out : (addr buffered-file), segments 53/push-ebx 56/push-esi 57/push-edi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx - # var datum/edi : slice + # var datum/edi: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 7/rm32/edi . . . 4/r32/esp . . # copy esp to edi @@ -2577,13 +2577,13 @@ test-emit-segments-global-variable: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . var segments/ecx : (stream byte 10*16) + # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # . var labels/edx : (stream byte 512*16) + # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp 68/push 0x2000/imm32/length 68/push 0/imm32/read @@ -2814,13 +2814,13 @@ test-emit-segments-code-label: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . var segments/ecx : (stream byte 10*16) + # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # . var labels/edx : (stream byte 512*16) + # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp 68/push 0x2000/imm32/length 68/push 0/imm32/read @@ -3016,13 +3016,13 @@ test-emit-segments-code-label-absolute: e8/call clear-stream/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp - # . var segments/ecx : (stream byte 10*16) + # . var segments/ecx: (stream byte 10*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xa0/imm32 # subtract from esp 68/push 0xa0/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # . var labels/edx : (stream byte 512*16) + # . var labels/edx: (stream byte 512*16) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x2000/imm32 # subtract from esp 68/push 0x2000/imm32/length 68/push 0/imm32/read @@ -3173,7 +3173,7 @@ test-emit-segments-code-label-absolute: 5d/pop-to-ebp c3/return -emit-headers: # out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +emit-headers: # out: (addr buffered-file), segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # pseudocode: # emit-elf-header(out, segments, labels) # curr-segment = segments->data @@ -3311,7 +3311,7 @@ $emit-headers:end: 5d/pop-to-ebp c3/return -emit-elf-header: # out : (addr buffered-file), segments : (addr stream {string, segment-info}), labels : (addr stream {string, label-info}) +emit-elf-header: # out: (addr buffered-file), segments: (addr stream {string, segment-info}), labels: (addr stream {string, label-info}) # pseudocode # *$Elf_e_entry = get(labels, "Entry")->address # *$Elf_e_phnum = segments->write / 16 # size of a row @@ -3379,7 +3379,7 @@ $emit-elf-header:end: 5d/pop-to-ebp c3/return -emit-elf-program-header-entry: # out : (addr buffered-file), curr-segment : (addr {string, segment-info}) +emit-elf-program-header-entry: # out: (addr buffered-file), curr-segment: (addr {string, segment-info}) # pseudocode: # *$Elf_p_offset = curr-segment->file-offset # *$Elf_p_vaddr = curr-segment->address @@ -3468,7 +3468,7 @@ $emit-elf-program-header-entry:end: # - some helpers for tests -stream-add4: # in : (addr stream byte), key : addr, val1 : addr, val2 : addr, val3 : addr +stream-add4: # in: (addr stream byte), key: addr, val1: addr, val2: addr, val3: addr # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3554,7 +3554,7 @@ $stream-add4:abort: # l: (addr slice) # one gotcha: 's5' must not be empty -trace-sssns: # s1 : (addr string), s2 : (addr string), s3 : (addr string), n4 : int, s5 : (addr string) +trace-sssns: # s1: (addr string), s2: (addr string), s3: (addr string), n4: int, s5: (addr string) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3661,7 +3661,7 @@ test-trace-sssns: 5d/pop-to-ebp c3/return -trace-snsns: # s1 : (addr string), n2 : int, s3 : (addr string), n4 : int, s5 : (addr string) +trace-snsns: # s1: (addr string), n2: int, s3: (addr string), n4: int, s5: (addr string) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3768,7 +3768,7 @@ test-trace-snsns: 5d/pop-to-ebp c3/return -trace-slsls: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), l4 : (addr slice), s5 : (addr string) +trace-slsls: # s1: (addr string), l2: (addr slice), s3: (addr string), l4: (addr slice), s5: (addr string) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3830,7 +3830,7 @@ test-trace-slsls: 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx 05/add-to-eax 4/imm32 - # var b/ebx : slice = {eax, ecx} + # var b/ebx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx @@ -3839,7 +3839,7 @@ test-trace-slsls: 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx 05/add-to-eax 4/imm32 - # var d/edx : slice = {eax, ecx} + # var d/edx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx @@ -3893,7 +3893,7 @@ test-trace-slsls: 5d/pop-to-ebp c3/return -trace-slsns: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), n4 : int, s5 : (addr string) +trace-slsns: # s1: (addr string), l2: (addr slice), s3: (addr string), n4: int, s5: (addr string) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -3955,7 +3955,7 @@ test-trace-slsns: 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx 05/add-to-eax 4/imm32 - # var b/ebx : slice = {eax, ecx} + # var b/ebx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx @@ -4009,7 +4009,7 @@ test-trace-slsns: 5d/pop-to-ebp c3/return -trace-slsss: # s1 : (addr string), l2 : (addr slice), s3 : (addr string), s4 : (addr string), s5 : (addr string) +trace-slsss: # s1: (addr string), l2: (addr slice), s3: (addr string), s4: (addr string), s5: (addr string) # . prologue 55/push-ebp 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp @@ -4071,7 +4071,7 @@ test-trace-slsss: 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . . # copy *eax to ecx 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 . # copy eax+ecx+4 to ecx 05/add-to-eax 4/imm32 - # var b/ebx : slice = {eax, ecx} + # var b/ebx: slice = {eax, ecx} 51/push-ecx 50/push-eax 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . . # copy esp to ebx @@ -4125,7 +4125,7 @@ test-trace-slsss: 5d/pop-to-ebp c3/return -num-bytes: # line : (addr stream byte) -> eax : int +num-bytes: # line: (addr stream byte) -> eax: int # pseudocode: # result = 0 # while true @@ -4150,7 +4150,7 @@ num-bytes: # line : (addr stream byte) -> eax : int 53/push-ebx # var result/eax = 0 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . . # clear eax - # var word-slice/ecx : slice + # var word-slice/ecx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx diff --git a/apps/tests.subx b/apps/tests.subx index 118e027e..62fc19d0 100644 --- a/apps/tests.subx +++ b/apps/tests.subx @@ -67,11 +67,11 @@ $subx-tests-main:end: b8/copy-to-eax 1/imm32/exit cd/syscall 0x80/imm8 -subx-gen-run-tests: # in : (addr buffered-file), out : (addr buffered-file) +subx-gen-run-tests: # in: (addr buffered-file), out: (addr buffered-file) # pseudocode # bool tests-found = false - # var line : (stream byte 512) - # var new-code-segment : (handle stream byte) = new-stream(Segment-size, 1) + # var line: (stream byte 512) + # var new-code-segment: (handle stream byte) = new-stream(Segment-size, 1) # write(new-code-segment, "\n== code\n") # write(new-code-segment, "run-tests:\n") # while true @@ -101,13 +101,13 @@ subx-gen-run-tests: # in : (addr buffered-file), out : (addr buffered-file) 52/push-edx 53/push-ebx 57/push-edi - # var line/ecx : (stream byte 512) + # var line/ecx: (stream byte 512) 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32 # subtract from esp 68/push 0x200/imm32/length 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . . # copy esp to ecx - # var word-slice/edx : slice + # var word-slice/edx: slice 68/push 0/imm32/end 68/push 0/imm32/start 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . . # copy esp to edx |