diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-09-19 14:57:55 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-09-19 15:12:50 -0700 |
commit | a9d473e22426a7636980b8266e9b48cbae3bba05 (patch) | |
tree | 9428315eb5570c68c3bc3aff2623a0a8a943eb49 | |
parent | 37d40d4096b5ef6f256efc2b90ea4c75883d6f59 (diff) | |
download | mu-a9d473e22426a7636980b8266e9b48cbae3bba05.tar.gz |
5668 - start reorg to permit syntax sugar in layers
Right now we always build the library before any apps. Apps are where our syntax sugar translators (sigils, calls, braces) live. So we can't use sugar in the standard library. New idea: move all code for SubX phases into the top-level. Perhaps we should also just build a single file rather than pipeline stages. But for now we'll build each phase by building up to some specific layer. This will simplify test_apps and move lots of one-off logic to a more standard form in test_layers. I'm also going to reorg existing layers so that we introduce each phase at a point where it mostly only gets the helpers it needs. This commit itself is just cleaning up some common strings. Using explicit names for them streamlines binaries a bit.
-rw-r--r-- | 051test.subx | 14 | ||||
-rw-r--r-- | 063error.subx | 2 | ||||
-rw-r--r-- | 067parse-hex.subx | 2 | ||||
-rw-r--r-- | 075array-equal.subx | 2 | ||||
-rw-r--r-- | 078table.subx | 8 | ||||
-rwxr-xr-x | apps/assort | bin | 40205 -> 40175 bytes | |||
-rw-r--r-- | apps/assort.subx | 2 | ||||
-rwxr-xr-x | apps/braces | bin | 39594 -> 39569 bytes | |||
-rwxr-xr-x | apps/calls | bin | 44955 -> 44930 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 33939 -> 33919 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 34498 -> 34478 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 45409 -> 45364 bytes | |||
-rw-r--r-- | apps/dquotes.subx | 18 | ||||
-rwxr-xr-x | apps/factorial | bin | 32951 -> 32931 bytes | |||
-rwxr-xr-x | apps/handle | bin | 33805 -> 33785 bytes | |||
-rwxr-xr-x | apps/hex | bin | 42598 -> 42573 bytes | |||
-rwxr-xr-x | apps/pack | bin | 52891 -> 52846 bytes | |||
-rw-r--r-- | apps/pack.subx | 8 | ||||
-rwxr-xr-x | apps/sigils | bin | 52918 -> 52868 bytes | |||
-rw-r--r-- | apps/sigils.subx | 10 | ||||
-rw-r--r-- | apps/subx-common.subx | 2 | ||||
-rwxr-xr-x | apps/survey | bin | 49488 -> 49448 bytes | |||
-rw-r--r-- | apps/survey.subx | 16 | ||||
-rwxr-xr-x | apps/tests | bin | 39017 -> 38992 bytes |
24 files changed, 42 insertions, 42 deletions
diff --git a/051test.subx b/051test.subx index d5b99907..1619c847 100644 --- a/051test.subx +++ b/051test.subx @@ -90,4 +90,18 @@ Newline: Num-test-failures: 0/imm32 +# length-prefixed string containing just a single space +Space: + # size + 1/imm32 + # data + 20/space + +# length-prefixed string containing just a single slash +Slash: + # size + 1/imm32 + # data + 2f/slash + # . . vim:nowrap:textwidth=0 diff --git a/063error.subx b/063error.subx index 8dfaac57..c40586c7 100644 --- a/063error.subx +++ b/063error.subx @@ -26,7 +26,7 @@ error: # ed : (address exit-descriptor), out : fd or (address stream), msg : (a e8/call write/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp - # write(out, Newline) + # write(out, "\n") # . . push args 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) diff --git a/067parse-hex.subx b/067parse-hex.subx index 2a5becca..06eae408 100644 --- a/067parse-hex.subx +++ b/067parse-hex.subx @@ -859,7 +859,7 @@ $from-hex-char:abort: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . _write(2/stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push 2/imm32/stderr # . . call e8/call _write/disp32 diff --git a/075array-equal.subx b/075array-equal.subx index f89035f8..7f5109f9 100644 --- a/075array-equal.subx +++ b/075array-equal.subx @@ -490,7 +490,7 @@ test-parse-array-of-ints-just-whitespace: 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp # eax = parse-array-of-ints(Heap, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 68/push Heap/imm32 # . . call e8/call parse-array-of-ints/disp32 diff --git a/078table.subx b/078table.subx index 95dd6150..602cd872 100644 --- a/078table.subx +++ b/078table.subx @@ -107,7 +107,7 @@ $get:abort: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . _write(2/stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push 2/imm32/stderr # . . call e8/call _write/disp32 @@ -288,7 +288,7 @@ $get-slice:abort: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . _write(2/stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push 2/imm32/stderr # . . call e8/call _write/disp32 @@ -1010,7 +1010,7 @@ $get-or-stop:stop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(err, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 . # push *(ebp+24) # . . call e8/call write-buffered/disp32 @@ -1228,7 +1228,7 @@ $get-slice-or-stop:stop: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(err, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 . # push *(ebp+24) # . . call e8/call write-buffered/disp32 diff --git a/apps/assort b/apps/assort index aac0b75a..69d3436b 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/assort.subx b/apps/assort.subx index 71aee164..2e9fee47 100644 --- a/apps/assort.subx +++ b/apps/assort.subx @@ -250,7 +250,7 @@ test-convert: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write(_test-input-stream, "\n") # empty line # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push _test-input-stream/imm32 # . . call e8/call write/disp32 diff --git a/apps/braces b/apps/braces index c3f88cd8..67c0f75a 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index 11179969..2ec41b22 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index 62c12a81..e8992622 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index e22acd4a..cddb2555 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index d3f84e8b..ede07c89 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/dquotes.subx b/apps/dquotes.subx index 6e5882b9..337992e4 100644 --- a/apps/dquotes.subx +++ b/apps/dquotes.subx @@ -226,7 +226,7 @@ $convert:regular-word: $convert:next-word: # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -472,7 +472,7 @@ test-convert-is-idempotent-by-default: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write(_test-input-stream, "\n") # empty line # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push _test-input-stream/imm32 # . . call e8/call write/disp32 @@ -2315,20 +2315,6 @@ test-string-length-at-start-of-slice-escaped: Next-string-literal: # tracks the next auto-generated variable name 1/imm32 -# length-prefixed string containing just a single space -Space: - # size - 1/imm32 - # data - 20/space - -# length-prefixed string containing just a single slash -Slash: - # size - 1/imm32 - # data - 2f/slash - _test-slice-abc: 22/dquote 61/a 62/b 63/c 22/dquote # "abc" 2f/slash 64/d diff --git a/apps/factorial b/apps/factorial index ad02a27e..19f57d7a 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/handle b/apps/handle index c4ed2356..1ac9ea30 100755 --- a/apps/handle +++ b/apps/handle Binary files differdiff --git a/apps/hex b/apps/hex index e5cdd533..f0828df4 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/pack b/apps/pack index 55fcfb6d..56826bf4 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/pack.subx b/apps/pack.subx index f4caceba..4dda514b 100644 --- a/apps/pack.subx +++ b/apps/pack.subx @@ -1133,7 +1133,7 @@ $convert-data:single-byte: $convert-data:break: # write-buffered(out, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -2102,7 +2102,7 @@ $emit-opcodes:op1: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -2195,7 +2195,7 @@ $emit-opcodes:op2: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -2274,7 +2274,7 @@ $emit-opcodes:op3: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 diff --git a/apps/sigils b/apps/sigils index 22dadf70..4a4bebf1 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/sigils.subx b/apps/sigils.subx index e495483e..8c8beba7 100644 --- a/apps/sigils.subx +++ b/apps/sigils.subx @@ -341,7 +341,7 @@ $convert:regular-word: $convert:next-word: # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -2582,7 +2582,7 @@ $parse-effective-address:error1: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(Stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push Stderr/imm32 # . . call e8/call write-buffered/disp32 @@ -2621,7 +2621,7 @@ $parse-effective-address:error2: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(Stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push Stderr/imm32 # . . call e8/call write-buffered/disp32 @@ -2660,7 +2660,7 @@ $parse-effective-address:error3: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(Stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push Stderr/imm32 # . . call e8/call write-buffered/disp32 @@ -4194,7 +4194,7 @@ $next-hex-int:abort: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp # . _write(2/stderr, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 68/push 2/imm32/stderr # . . call e8/call _write/disp32 diff --git a/apps/subx-common.subx b/apps/subx-common.subx index 7cce0d20..cc3b12af 100644 --- a/apps/subx-common.subx +++ b/apps/subx-common.subx @@ -699,7 +699,7 @@ $emit:name: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # . write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) # . . call e8/call write-buffered/disp32 diff --git a/apps/survey b/apps/survey index b55bc007..ec7e318f 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/survey.subx b/apps/survey.subx index e685d436..678ed116 100644 --- a/apps/survey.subx +++ b/apps/survey.subx @@ -197,7 +197,7 @@ convert: # infile : (address buffered-file), out : (address buffered-file) -> < #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp #? # . write(2/stderr, "\n") #? # . . push args -#? 68/push "\n"/imm32 +#? 68/push Newline/imm32 #? 68/push 2/imm32/stderr #? # . . call #? e8/call write/disp32 @@ -260,7 +260,7 @@ convert: # infile : (address buffered-file), out : (address buffered-file) -> < #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp #? # . write(2/stderr, "\n") #? # . . push args -#? 68/push "\n"/imm32 +#? 68/push Newline/imm32 #? 68/push 2/imm32/stderr #? # . . call #? e8/call write/disp32 @@ -416,7 +416,7 @@ convert: # infile : (address buffered-file), out : (address buffered-file) -> < #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp #? # . write(2/stderr, "\n") #? # . . push args -#? 68/push "\n"/imm32 +#? 68/push Newline/imm32 #? 68/push 2/imm32/stderr #? # . . call #? e8/call write/disp32 @@ -1160,7 +1160,7 @@ $compute-offsets:case-default: #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp #? # . write(2/stderr, "\n") #? # . . push args -#? 68/push "\n"/imm32 +#? 68/push Newline/imm32 #? 68/push 2/imm32/stderr #? # . . call #? e8/call write/disp32 @@ -2214,7 +2214,7 @@ $emit-segments:2-character: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, " ") # . . push args - 68/push " "/imm32 + 68/push Space/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 . # push *(ebp+12) # . . call e8/call write-buffered/disp32 @@ -3328,7 +3328,7 @@ $emit-headers:loop: #? 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32 # add to esp #? # . write(2/stderr, "\n") #? # . . push args -#? 68/push "\n"/imm32 +#? 68/push Newline/imm32 #? 68/push 2/imm32/stderr #? # . . call #? e8/call write/disp32 @@ -3416,7 +3416,7 @@ emit-elf-header: # out : (address buffered-file), segments : (address stream {s 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) # . . call e8/call write-buffered/disp32 @@ -3504,7 +3504,7 @@ $emit-elf-program-header-entry:really-emit: 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32 # add to esp # write-buffered(out, "\n") # . . push args - 68/push "\n"/imm32 + 68/push Newline/imm32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 . # push *(ebp+8) # . . call e8/call write-buffered/disp32 diff --git a/apps/tests b/apps/tests index 2fc7071c..36ba05ea 100755 --- a/apps/tests +++ b/apps/tests Binary files differ |