about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-09-19 14:57:55 -0700
committerKartik Agaram <vc@akkartik.com>2019-09-19 15:12:50 -0700
commita9d473e22426a7636980b8266e9b48cbae3bba05 (patch)
tree9428315eb5570c68c3bc3aff2623a0a8a943eb49 /apps
parent37d40d4096b5ef6f256efc2b90ea4c75883d6f59 (diff)
downloadmu-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.
Diffstat (limited to 'apps')
-rwxr-xr-xapps/assortbin40205 -> 40175 bytes
-rw-r--r--apps/assort.subx2
-rwxr-xr-xapps/bracesbin39594 -> 39569 bytes
-rwxr-xr-xapps/callsbin44955 -> 44930 bytes
-rwxr-xr-xapps/crenshaw2-1bin33939 -> 33919 bytes
-rwxr-xr-xapps/crenshaw2-1bbin34498 -> 34478 bytes
-rwxr-xr-xapps/dquotesbin45409 -> 45364 bytes
-rw-r--r--apps/dquotes.subx18
-rwxr-xr-xapps/factorialbin32951 -> 32931 bytes
-rwxr-xr-xapps/handlebin33805 -> 33785 bytes
-rwxr-xr-xapps/hexbin42598 -> 42573 bytes
-rwxr-xr-xapps/packbin52891 -> 52846 bytes
-rw-r--r--apps/pack.subx8
-rwxr-xr-xapps/sigilsbin52918 -> 52868 bytes
-rw-r--r--apps/sigils.subx10
-rw-r--r--apps/subx-common.subx2
-rwxr-xr-xapps/surveybin49488 -> 49448 bytes
-rw-r--r--apps/survey.subx16
-rwxr-xr-xapps/testsbin39017 -> 38992 bytes
19 files changed, 21 insertions, 35 deletions
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