diff --git a/linux/100.txt b/linux/100.txt index 5d309194..2cb43d8d 100644 --- a/linux/100.txt +++ b/linux/100.txt @@ -3,9 +3,9 @@ We're now past C++ bootstrap. Layers in the 1xx series are in bare SubX, without any syntax sugar. They are intended to be used by the phases of the self-hosted translator to replicate the functionality of the C++ bootstrap: - apps/hex.subx - apps/survey_elf.subx - apps/pack.subx - apps/dquotes.subx - apps/assort.subx - apps/tests.subx + hex.subx + survey_elf.subx + pack.subx + dquotes.subx + assort.subx + tests.subx diff --git a/linux/200.txt b/linux/200.txt index 5dd57840..9bfc1c20 100644 --- a/linux/200.txt +++ b/linux/200.txt @@ -1,5 +1,5 @@ Layers in the 2xx series are in bare SubX, without any syntax sugar. They are intended to be used by various syntax-sugar phases: - apps/sigils.subx - apps/calls.subx - apps/braces.subx + sigils.subx + calls.subx + braces.subx diff --git a/linux/assort.subx b/linux/assort.subx index 96130ded..d69a3bd9 100644 --- a/linux/assort.subx +++ b/linux/assort.subx @@ -7,7 +7,7 @@ # because we don't know if they refer to the line above or the line below. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/assort.subx -o apps/assort +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx assort.subx -o assort # $ cat x # == code # abc diff --git a/linux/bootstrap/011run.cc b/linux/bootstrap/011run.cc index 424e40e9..18ac0903 100644 --- a/linux/bootstrap/011run.cc +++ b/linux/bootstrap/011run.cc @@ -27,7 +27,7 @@ put_new(Help, "syntax", "after a '/', but they can never contain whitespace. Metadata has no effect\n" "at runtime, but can be handy when rewriting macros.\n" "\n" - "Check out the example programs in the apps/ directory, particularly apps/ex*.\n" + "Check out the example programs linux/ex*.\n" ); :(before "End Help Contents") cerr << " syntax\n"; diff --git a/linux/braces.subx b/linux/braces.subx index d6b8f0f4..57853985 100644 --- a/linux/braces.subx +++ b/linux/braces.subx @@ -1,8 +1,8 @@ # Structured control flow using break/loop rather than jump. # # To run (on Linux): -# $ ./translate_subx init.linux [012]*.subx apps/subx-params.subx apps/braces.subx -# $ mv a.elf apps/braces +# $ ./translate_subx init.linux [012]*.subx subx-params.subx braces.subx +# $ mv a.elf braces # # Example 1: # $ cat x.subx @@ -10,7 +10,7 @@ # 7c/jump-if-< break/disp8 # 74/jump-if-= loop/disp8 # } -# $ cat x.subx |apps/braces +# $ cat x.subx |braces # _loop1: # 7c/jump-if-< _break1/disp8 # 74/jump-if-= _loop1/disp8 @@ -24,7 +24,7 @@ # { # 74/jump-if-= loop/disp8 # } -# $ cat x.subx |apps/braces +# $ cat x.subx |braces # _loop1: # 7c/jump-if-< _break1/disp8 # _break1: @@ -40,7 +40,7 @@ # } # 7c/jump-if-< loop/disp8 # } -# $ cat x.subx |apps/braces +# $ cat x.subx |braces # _loop1: # _loop2: # 74/jump-if-= _loop2/disp8 diff --git a/linux/calls.subx b/linux/calls.subx index 903ae0f2..cbe327d3 100644 --- a/linux/calls.subx +++ b/linux/calls.subx @@ -1,18 +1,18 @@ # Function calls in a single line. # # To run (on Linux): -# $ ./translate_subx init.linux [012]*.subx apps/subx-params.subx apps/calls.subx -# $ mv a.elf apps/calls +# $ ./translate_subx init.linux [012]*.subx subx-params.subx calls.subx +# $ mv a.elf calls # # Example 1: -# $ echo '(foo %eax)' | apps/calls +# $ echo '(foo %eax)' | calls # # . (foo %eax) # output has comments # ff 6/subop/push %eax # push # e8/call foo/disp32 # call # 81 0/subop/add %esp 4/imm32 # undo push # # Example 2: -# $ echo '(foo Var1 *(eax + 4) "blah")' | apps/calls +# $ echo '(foo Var1 *(eax + 4) "blah")' | calls # # . (foo Var1 *(eax + 4) "blah") # 68/push "blah"/imm32 # ff 6/subop/push *(eax + 4) # push args in.. diff --git a/linux/crenshaw2-1.subx b/linux/crenshaw2-1.subx index 41e3ad4e..ade0399a 100644 --- a/linux/crenshaw2-1.subx +++ b/linux/crenshaw2-1.subx @@ -3,7 +3,7 @@ # except that we support hex digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1 +# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1.subx -o crenshaw2-1 # $ echo '3' |bootstrap/bootstrap run crenshaw2-1 # Expected output: # # syscall(exit, 3) diff --git a/linux/crenshaw2-1b.subx b/linux/crenshaw2-1b.subx index 6915bd01..d5b8194e 100644 --- a/linux/crenshaw2-1b.subx +++ b/linux/crenshaw2-1b.subx @@ -3,7 +3,7 @@ # except that we support hex numbers of multiple digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b +# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1b.subx -o crenshaw2-1b # $ echo '1a' |bootstrap/bootstrap run crenshaw2-1b # Expected output: # # syscall(exit, 1a) diff --git a/linux/dquotes.subx b/linux/dquotes.subx index 6de81cc8..2fb65d42 100644 --- a/linux/dquotes.subx +++ b/linux/dquotes.subx @@ -2,7 +2,7 @@ # Replace them with references to new variables in the data segment. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/dquotes.subx -o apps/dquotes +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx dquotes.subx -o dquotes # $ cat x # == code # ab "cd ef"/imm32 diff --git a/linux/ex1.subx b/linux/ex1.subx index 2316e17e..183c014a 100644 --- a/linux/ex1.subx +++ b/linux/ex1.subx @@ -2,7 +2,7 @@ # Just return 42. # # To run: -# $ bootstrap/bootstrap translate apps/ex1.subx -o apps/ex1 +# $ bootstrap/bootstrap translate ex1.subx -o ex1 # $ bootstrap/bootstrap run ex1 # Expected result: # $ echo $? diff --git a/linux/ex10.subx b/linux/ex10.subx index c62b32e2..2be53012 100644 --- a/linux/ex10.subx +++ b/linux/ex10.subx @@ -1,7 +1,7 @@ # String comparison: return 1 iff the two args passed in at the commandline are equal. # # To run: -# $ bootstrap/bootstrap translate apps/ex10.subx -o apps/ex10 +# $ bootstrap/bootstrap translate ex10.subx -o ex10 # $ bootstrap/bootstrap run ex10 abc abd # Expected result: # $ echo $? diff --git a/linux/ex11.subx b/linux/ex11.subx index 1d6f6fc4..d8596b8e 100644 --- a/linux/ex11.subx +++ b/linux/ex11.subx @@ -6,7 +6,7 @@ # a null-terminated 'kernel string' with a size-prefixed 'SubX string'. # # To run: -# $ bootstrap/bootstrap translate apps/ex11.subx -o apps/ex11 +# $ bootstrap/bootstrap translate ex11.subx -o ex11 # $ bootstrap/bootstrap run ex11 # runs a series of tests # ...... # all tests pass # diff --git a/linux/ex12.subx b/linux/ex12.subx index fa9e2b28..4f1617a7 100644 --- a/linux/ex12.subx +++ b/linux/ex12.subx @@ -2,7 +2,7 @@ # Create a new segment using mmap, save the address, write to it. # # To run: -# $ bootstrap/bootstrap translate apps/ex12.subx -o apps/ex12 +# $ bootstrap/bootstrap translate ex12.subx -o ex12 # $ bootstrap/bootstrap run ex12 # You shouldn't get a segmentation fault. diff --git a/linux/ex13.subx b/linux/ex13.subx index 295e9d2f..862bf897 100644 --- a/linux/ex13.subx +++ b/linux/ex13.subx @@ -1,7 +1,7 @@ # Compare 3 and 3. # # To run: -# $ bootstrap/bootstrap translate apps/ex13.subx -o apps/ex13 +# $ bootstrap/bootstrap translate ex13.subx -o ex13 # $ bootstrap/bootstrap run ex13 # Expected result: # $ echo $? diff --git a/linux/ex14.subx b/linux/ex14.subx index bcf68641..531bae7a 100644 --- a/linux/ex14.subx +++ b/linux/ex14.subx @@ -1,7 +1,7 @@ # Multiply 2 numbers. # # To run: -# $ bootstrap/bootstrap translate apps/ex14.subx -o apps/ex14 +# $ bootstrap/bootstrap translate ex14.subx -o ex14 # $ bootstrap/bootstrap run ex14 # Expected result: # $ echo $? diff --git a/linux/ex2.subx b/linux/ex2.subx index 55aadbd4..5ca39872 100644 --- a/linux/ex2.subx +++ b/linux/ex2.subx @@ -1,7 +1,7 @@ # Add 3 and 4, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate apps/ex2.subx -o apps/ex2 +# $ bootstrap/bootstrap translate ex2.subx -o ex2 # $ bootstrap/bootstrap run ex2 # Expected result: # $ echo $? diff --git a/linux/ex3.subx b/linux/ex3.subx index caf6ef26..5b74d76c 100644 --- a/linux/ex3.subx +++ b/linux/ex3.subx @@ -1,7 +1,7 @@ # Add the first 10 numbers, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate apps/ex3.subx -o apps/ex3 +# $ bootstrap/bootstrap translate ex3.subx -o ex3 # $ bootstrap/bootstrap run ex3 # Expected result: # $ echo $? diff --git a/linux/ex4.subx b/linux/ex4.subx index f054b748..ee78ce7d 100644 --- a/linux/ex4.subx +++ b/linux/ex4.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a global, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate apps/ex4.subx -o apps/ex4 +# $ bootstrap/bootstrap translate ex4.subx -o ex4 # $ bootstrap/bootstrap run ex4 == data diff --git a/linux/ex5.subx b/linux/ex5.subx index a3b1acfb..e8957ea7 100644 --- a/linux/ex5.subx +++ b/linux/ex5.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a local on the stack, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate apps/ex5.subx -o apps/ex5 +# $ bootstrap/bootstrap translate ex5.subx -o ex5 # $ bootstrap/bootstrap run ex5 == code diff --git a/linux/ex6.subx b/linux/ex6.subx index 2d1625f8..5715e94f 100644 --- a/linux/ex6.subx +++ b/linux/ex6.subx @@ -1,7 +1,7 @@ # Print out a (global variable) string to stdout. # # To run: -# $ bootstrap/bootstrap translate apps/ex6.subx -o apps/ex6 +# $ bootstrap/bootstrap translate ex6.subx -o ex6 # $ bootstrap/bootstrap run ex6 # Hello, world! diff --git a/linux/ex7.subx b/linux/ex7.subx index 5962c5f7..ad1a50b6 100644 --- a/linux/ex7.subx +++ b/linux/ex7.subx @@ -5,7 +5,7 @@ # the character read. # # To run: -# $ bootstrap/bootstrap translate apps/ex7.subx -o apps/ex7 +# $ bootstrap/bootstrap translate ex7.subx -o ex7 # $ bootstrap/bootstrap run ex7 # Expected result: # $ echo $? diff --git a/linux/ex8.subx b/linux/ex8.subx index 5a08b039..909d1adb 100644 --- a/linux/ex8.subx +++ b/linux/ex8.subx @@ -1,7 +1,7 @@ # Example reading commandline arguments: compute length of first arg. # # To run: -# $ bootstrap/bootstrap translate apps/ex8.subx -o apps/ex8 +# $ bootstrap/bootstrap translate ex8.subx -o ex8 # $ bootstrap/bootstrap run ex8 abc de fghi # Expected result: # $ echo $? diff --git a/linux/ex9.subx b/linux/ex9.subx index 594c9575..cbab3aa9 100644 --- a/linux/ex9.subx +++ b/linux/ex9.subx @@ -4,7 +4,7 @@ # letter of second arg. # # To run: -# $ bootstrap/bootstrap translate apps/ex9.subx -o apps/ex9 +# $ bootstrap/bootstrap translate ex9.subx -o ex9 # $ bootstrap/bootstrap run ex9 z x # Expected result: # $ echo $? diff --git a/linux/factorial.mu b/linux/factorial.mu index d2088486..7eccc1ec 100644 --- a/linux/factorial.mu +++ b/linux/factorial.mu @@ -14,7 +14,7 @@ # There's only one test in this file, but you'll also see tests running from # Mu's standard library. # -# Compare apps/factorial4.subx +# Compare factorial4.subx fn factorial n: int -> _/eax: int { compare n, 1 diff --git a/linux/factorial.subx b/linux/factorial.subx index 8dddbd4d..1bcc0a9d 100644 --- a/linux/factorial.subx +++ b/linux/factorial.subx @@ -1,7 +1,7 @@ ## compute the factorial of 5, and print the result # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o apps/factorial +# $ bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial2.subx b/linux/factorial2.subx index 3ef160e1..16af9008 100644 --- a/linux/factorial2.subx +++ b/linux/factorial2.subx @@ -4,7 +4,7 @@ # rm32 operands # # To run: -# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial +# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? @@ -16,7 +16,7 @@ # ........ # Every '.' indicates a passing test. Failing tests get a 'F'. # -# Compare apps/factorial.subx +# Compare factorial.subx == code diff --git a/linux/factorial3.subx b/linux/factorial3.subx index 5f96477d..72b76963 100644 --- a/linux/factorial3.subx +++ b/linux/factorial3.subx @@ -5,7 +5,7 @@ # function calls # # To run: -# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial +# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? @@ -17,7 +17,7 @@ # ........ # Every '.' indicates a passing test. Failing tests get a 'F'. # -# Compare apps/factorial2.subx +# Compare factorial2.subx == code diff --git a/linux/factorial4.subx b/linux/factorial4.subx index 41de8736..219fce41 100644 --- a/linux/factorial4.subx +++ b/linux/factorial4.subx @@ -6,7 +6,7 @@ # control flow # # To run: -# $ ./translate_subx init.linux [01]*.subx apps/factorial.subx -o apps/factorial +# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? @@ -18,7 +18,7 @@ # ........ # Every '.' indicates a passing test. Failing tests get a 'F'. # -# Compare apps/factorial3.subx +# Compare factorial3.subx == code diff --git a/linux/hex.subx b/linux/hex.subx index 6024eb25..242dc5d4 100644 --- a/linux/hex.subx +++ b/linux/hex.subx @@ -3,7 +3,7 @@ # comments between '#' and newline. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/hex.subx -o apps/hex +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx hex.subx -o hex # $ echo '80 81 82 # comment' |bootstrap/bootstrap run hex |xxd - # Expected output: # 00000000: 8081 82 diff --git a/linux/mu.subx b/linux/mu.subx index e65fa9cc..120d0cce 100644 --- a/linux/mu.subx +++ b/linux/mu.subx @@ -2,7 +2,7 @@ # http://akkartik.name/post/mu-2019-2 # # To run: -# $ ./translate_subx init.linux [0-9]*.subx apps/mu.subx +# $ ./translate_subx init.linux [0-9]*.subx mu.subx # $ ./a.elf < prog.mu > prog.elf # == Goals diff --git a/linux/pack.subx b/linux/pack.subx index 32785c35..7ed01c5e 100644 --- a/linux/pack.subx +++ b/linux/pack.subx @@ -3,7 +3,7 @@ # uses are left untouched. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/pack.subx -o apps/pack +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx pack.subx -o pack # $ echo '05/add-to-eax 0x20/imm32' |bootstrap/bootstrap run pack # Expected output: # 05 20 00 00 00 # 05/add-to-eax 0x20/imm32 diff --git a/linux/random.subx b/linux/random.subx index 7e9c0f0e..639638cc 100644 --- a/linux/random.subx +++ b/linux/random.subx @@ -1,7 +1,7 @@ # Repeatedly read 32-bit numbers from /dev/random, print them to stdout. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx apps/random.subx -o apps/random +# $ bootstrap/bootstrap translate [01]*.subx random.subx -o random # $ bootstrap/bootstrap run random == code 0x09000000 diff --git a/linux/sigils.subx b/linux/sigils.subx index f6c1c458..87d188a7 100644 --- a/linux/sigils.subx +++ b/linux/sigils.subx @@ -2,7 +2,7 @@ # arguments. # # To run: -# $ bootstrap/bootstrap translate [012]*.subx apps/subx-params.subx apps/sigils.subx -o apps/sigils +# $ bootstrap/bootstrap translate [012]*.subx subx-params.subx sigils.subx -o sigils # # We currently support the following notations: # diff --git a/linux/stats.txt b/linux/stats.txt index 4d229e3a..1efae374 100644 --- a/linux/stats.txt +++ b/linux/stats.txt @@ -1,52 +1,52 @@ ## Lines in source files - Initial -whitespace/comments/tests -apps/factorial.subx 120 44 -apps/crenshaw2-1.subx 561 180 -apps/crenshaw2-1b.subx 757 186 -apps/hex.subx 1442 149 -apps/survey_elf.subx 4733 905 -apps/pack.subx 5881 840 -apps/dquotes.subx 1925 383 -apps/assort.subx 905 183 -apps/tests.subx 284 137 -apps/sigils.subx 4641 896 -apps/calls.subx 1785 448 -apps/braces.subx 360 121 -apps/mu.subx 36692 12858 + Initial -whitespace/comments/tests +factorial.subx 120 44 +crenshaw2-1.subx 561 180 +crenshaw2-1b.subx 757 186 +hex.subx 1442 149 +survey_elf.subx 4733 905 +pack.subx 5881 840 +dquotes.subx 1925 383 +assort.subx 905 183 +tests.subx 284 137 +sigils.subx 4641 896 +calls.subx 1785 448 +braces.subx 360 121 +mu.subx 36692 12858 ## Total source lines needed including libraries - Initial -whitespace/comments/tests/dead code -apps/factorial.subx 8436 1700 -apps/crenshaw2-1.subx 8644 1925 -apps/crenshaw2-1b.subx 8736 1931 -apps/hex.subx 9065 1908 -apps/survey_elf.subx 10217 3248 -apps/pack.subx 10589 2727 -apps/dquotes.subx 9262 2468 -apps/assort.subx 8686 2425 -apps/tests.subx 8519 2214 -apps/sigils.subx 10578 3043 -apps/calls.subx 9242 2388 -apps/braces.subx 8545 2111 -apps/mu.subx 35438 15820 + Initial -whitespace/comments/tests/dead code +factorial.subx 8436 1700 +crenshaw2-1.subx 8644 1925 +crenshaw2-1b.subx 8736 1931 +hex.subx 9065 1908 +survey_elf.subx 10217 3248 +pack.subx 10589 2727 +dquotes.subx 9262 2468 +assort.subx 8686 2425 +tests.subx 8519 2214 +sigils.subx 10578 3043 +calls.subx 9242 2388 +braces.subx 8545 2111 +mu.subx 35438 15820 ## executable size in KB - Initial -tests/dead code -apps/crenshaw2-1 41 4.3 -apps/crenshaw2-1b 42 5.2 -apps/factorial 42 5.2 -apps/hex 45 5.0 -apps/survey_elf 51 9.6 -apps/pack 54 7.6 -apps/dquotes 46 6.5 -apps/assort 42 6.4 -apps/tests 41 5.8 -apps/sigils 54 9.1 -apps/calls 47 7.1 -apps/braces 42 5.9 -apps/mu 563 131.0 + Initial -tests/dead code +crenshaw2-1 41 4.3 +crenshaw2-1b 42 5.2 +factorial 42 5.2 +hex 45 5.0 +survey_elf 51 9.6 +pack 54 7.6 +dquotes 46 6.5 +assort 42 6.4 +tests 41 5.8 +sigils 54 9.1 +calls 47 7.1 +braces 42 5.9 +mu 563 131.0 -## history of apps/mu.subx +## history of mu.subx date commit mu.subx -tests/cmts binary (KB excl. dead code) parsing function headers 2019 Oct 30 5725 621 277 6.9 function calls Nov 10 5739 1202 346 7.2 diff --git a/linux/survey_baremetal.subx b/linux/survey_baremetal.subx index 41314e53..9d31466e 100644 --- a/linux/survey_baremetal.subx +++ b/linux/survey_baremetal.subx @@ -3,7 +3,7 @@ # Use the addresses assigned to replace labels. # # To build: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/survey_baremetal.subx -o apps/survey_baremetal +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx survey_baremetal.subx -o survey_baremetal # # The expected input is a stream of bytes and some interspersed labels. # Comments and '==' segment headers are allowed, but names are ignored. The diff --git a/linux/survey_elf.subx b/linux/survey_elf.subx index f1d1bc96..211408cc 100644 --- a/linux/survey_elf.subx +++ b/linux/survey_elf.subx @@ -5,7 +5,7 @@ # b) add an ELF header and segment headers with addresses and offsets correctly filled in # # To build: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/survey_elf.subx -o apps/survey_elf +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx survey_elf.subx -o survey_elf # # The expected input is a stream of bytes with '==' segment headers, comments # and some interspersed labels. diff --git a/linux/tests.subx b/linux/tests.subx index 63d64194..1075b113 100644 --- a/linux/tests.subx +++ b/linux/tests.subx @@ -2,7 +2,7 @@ # all functions starting with 'test-'. # # To build: -# $ bootstrap/bootstrap translate [01]*.subx apps/subx-params.subx apps/tests.subx -o apps/tests +# $ bootstrap/bootstrap translate [01]*.subx subx-params.subx tests.subx -o tests == code # instruction effective address register displacement immediate diff --git a/linux/tile/README.md b/linux/tile/README.md index e8b96d09..f82c838a 100644 --- a/linux/tile/README.md +++ b/linux/tile/README.md @@ -27,7 +27,7 @@ $ ./a.elf type This is just a prototype. There are no tests. To add a new primitive you'll need to hard-code it into the `evaluate` -function (apps/tile/rpn.mu). +function (linux/tile/rpn.mu). There's also a second place you'll want to teach about predefined primitives: -`bound-function?` (apps/tile/environment.mu) +`bound-function?` (linux/tile/environment.mu) diff --git a/subx.md b/subx.md index 26f2c4f3..4e28a49c 100644 --- a/subx.md +++ b/subx.md @@ -1,6 +1,6 @@ ## SubX -SubX is a notation for a subset of x86 machine code. [The Mu translator](http://akkartik.github.io/mu/html/apps/mu.subx.html) +SubX is a notation for a subset of x86 machine code. [The Mu translator](http://akkartik.github.io/mu/html/linux/mu.subx.html) is implemented in SubX and also emits SubX code. Here's an example program in SubX that adds 1 and 1 and returns the result to @@ -158,8 +158,8 @@ string literal surrounded by quotes (`"`) in an `imm32` argument. SubX will transparently copy it to the `data` segment and replace it with its address. Strings are the only place where a SubX word is allowed to contain spaces. -That should be enough information for writing SubX programs. The `apps/` -directory provides some fodder for practice in the `apps/ex*.subx` files, +That should be enough information for writing SubX programs. The `linux/` +directory provides some fodder for practice in the `linux/ex*.subx` files, giving a more gradual introduction to SubX features. In particular, you should -work through `apps/factorial4.subx`, which demonstrates all the above ideas in +work through `linux/factorial4.subx`, which demonstrates all the above ideas in concert. diff --git a/subx_bare.md b/subx_bare.md index ab909e72..f4e6a03e 100644 --- a/subx_bare.md +++ b/subx_bare.md @@ -79,7 +79,7 @@ and digest it: Here's an example showing these arguments at work: -apps/ex3.subx +linux/ex3.subx This program sums the first 10 natural numbers. By convention I use horizontal tabstops to help read instructions, dots to help follow the long lines, @@ -151,7 +151,8 @@ $ echo $? 42 # or, automating the above steps -$ ./translate_subx init.linux apps/ex1.subx +$ cd linux +$ ./translate_subx 000init.linux ex1.subx $ ./a.elf $ echo $? 42 @@ -160,7 +161,7 @@ $ echo $? Or, running in a VM on other platforms (much slower): ```sh -$ ./translate_subx_emulated init.linux apps/ex1.subx # generates identical a.elf to above +$ ./translate_subx_emulated init.linux linux/ex1.subx # generates identical a.elf to above $ bootstrap/bootstrap run a.elf $ echo $? 42 diff --git a/vimrc.vim b/vimrc.vim index 53a60e0d..8f902777 100644 --- a/vimrc.vim +++ b/vimrc.vim @@ -27,32 +27,6 @@ augroup LocalVimrc autocmd BufRead,BufNewFile *.subx set ft=subx augroup END -" Scenarios considered: -" opening or starting vim with a new or existing file without an extension (should interpret as C++) -" opening or starting vim with a new or existing file with a .mu extension -" starting vim or opening a buffer without a file name (ok to do nothing) -" opening a second file in a new or existing window (shouldn't mess up existing highlighting) -" reloading an existing file (shouldn't mess up existing highlighting) - -command! -nargs=1 E call EditMuFile("edit", ) -if exists("&splitvertical") - command! -nargs=1 S call EditMuFile("vert split", ) - command! -nargs=1 H call EditMuFile("hor split", ) -else - command! -nargs=1 S call EditMuFile("vert split", ) - command! -nargs=1 H call EditMuFile("split", ) -endif - -function! EditMuFile(cmd, arg) - let l:full_path = "apps/" . a:arg - if filereadable(l:full_path . ".mu") - let l:full_path = l:full_path . ".mu" - else - let l:full_path = l:full_path . ".subx" - endif - exec "silent! " . a:cmd . " " . l:full_path -endfunction - " we often want to crib lines of machine code from other files function! GrepSubX(regex) " https://github.com/mtth/scratch.vim