From 9e5e87ca3776efa5f0d772ed8cf348bf6ee4d08e Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 2 Jan 2020 01:41:55 -0800 Subject: 5865 Give the bootstrap C++ program a less salient name. --- 001help.cc | 16 ++++----- 002test.cc | 4 +-- 003trace.cc | 2 +- 010---vm.cc | 2 +- 030---translate.cc | 8 ++--- 032---operands.cc | 2 +- 036labels.cc | 8 ++--- 039debug.cc | 8 ++--- 052kernel-string-equal.subx | 4 +-- Readme.md | 40 ++++++++++----------- SubX-addressing-modes.md | 4 +-- bootstrap | 5 +++ build | 20 +++++------ build_and_test_until | 2 +- clean | 2 +- run_one_test | 2 +- subx | 5 --- test_apps | 88 ++++++++++++++++++++++----------------------- test_layers | 4 +-- translate_subx_debug | 2 +- translate_subx_emulated | 18 +++++----- 21 files changed, 123 insertions(+), 123 deletions(-) create mode 100755 bootstrap delete mode 100755 subx diff --git a/001help.cc b/001help.cc index d5e2b9a2..9dcc99e9 100644 --- a/001help.cc +++ b/001help.cc @@ -66,22 +66,22 @@ void init_help() { "programming directly in machine code, but you have to stick to the\n" "instructions it supports.\n" "\n" - "== Ways to invoke subx\n" + "== Ways to invoke bootstrap\n" "- Run tests:\n" - " subx test\n" + " bootstrap test\n" "- See this message:\n" - " subx --help\n" + " bootstrap --help\n" "- Convert a textual SubX program into a standard ELF binary that you can\n" " run on your computer:\n" - " subx translate input1.subx input2.subx ... -o \n" + " bootstrap translate input1.subx input2.subx ... -o \n" "- Run a SubX binary using SubX itself (for better error messages):\n" - " subx run \n" + " bootstrap run \n" "\n" "== Debugging aids\n" "- Add '--trace' to any of these commands to save a trace to disk at the end.\n" " This can run out of memory for long-running commands.\n" - "- Add '--debug' to add information to traces. 'subx --debug translate' will\n" - " save metadata to disk that 'subx --debug --trace run' uses to make traces\n" + "- Add '--debug' to add information to traces. 'bootstrap --debug translate'\n" + " will save metadata to disk that 'bootstrap --trace run' uses to make traces\n" " more informative.\n" "- Add '--dump --trace' to emit a trace incrementally to stderr.\n" " This approach will work even for long-running programs.\n" @@ -92,7 +92,7 @@ void init_help() { "\n" "To start learning how to write SubX programs, see Readme.md (particularly\n" "the section on the x86 instruction set) and then run:\n" - " subx help\n" + " bootstrap help\n" ); // End Help Texts } diff --git a/002test.cc b/002test.cc index f25e331f..9424cc1a 100644 --- a/002test.cc +++ b/002test.cc @@ -1,6 +1,6 @@ //: A simple test harness. To create new tests, define functions starting with //: 'test_'. To run all tests so defined, run: -//: $ ./mu test +//: $ ./bootstrap test //: //: Every layer should include tests, and can reach into previous layers. //: However, it seems like a good idea never to reach into tests from previous @@ -72,7 +72,7 @@ if (Run_tests) { :(after "End Main") //: Raise other unrecognized sub-commands as errors. -//: We couldn't do this until now because we want `./subx test` to always +//: We couldn't do this until now because we want `./bootstrap test` to always //: succeed, no matter how many layers are included in the build. cerr << "nothing to do\n"; return 1; diff --git a/003trace.cc b/003trace.cc index b4776d44..25b21825 100644 --- a/003trace.cc +++ b/003trace.cc @@ -190,7 +190,7 @@ void trace_stream::newline() { if (should_incrementally_print_trace()) { dump_trace_line(cerr, t); } - // Hack: on 'subx --trace --dump', emit only to stderr, not 'last_run'. + // Hack: on 'bootstrap --trace --dump', emit only to stderr, not 'last_run'. if (Dump_trace) past_lines.pop_back(); // economize on memory // End trace Commit } diff --git a/010---vm.cc b/010---vm.cc index d67667f7..a0724760 100644 --- a/010---vm.cc +++ b/010---vm.cc @@ -362,7 +362,7 @@ if (key == "opcodes") { cerr << " f3 " << p->first << ": " << p->second << '\n'; for (map::iterator p = Name_f3_0f.begin(); p != Name_f3_0f.end(); ++p) cerr << " f3 0f " << p->first << ": " << p->second << '\n'; - cerr << "Run `subx help instructions` for details on words like 'r32' and 'disp8'.\n" + cerr << "Run `bootstrap help instructions` for details on words like 'r32' and 'disp8'.\n" "For complete details on these instructions, consult the IA-32 manual (volume 2).\n" "There's various versions of it online, such as https://c9x.me/x86.\n" "The mnemonics in brackets will help you locate each instruction.\n"; diff --git a/030---translate.cc b/030---translate.cc index b950fce7..3c4c7f2f 100644 --- a/030---translate.cc +++ b/030---translate.cc @@ -10,10 +10,10 @@ if (is_equal(argv[1], "translate")) { // Outside of tests, traces must be explicitly requested. if (Trace_file.is_open()) Trace_stream = new trace_stream; reset(); - // Begin subx translate + // Begin bootstrap translate program p; string output_filename; - for (int i = /*skip 'subx translate'*/2; i < argc; ++i) { + for (int i = /*skip 'bootstrap translate'*/2; i < argc; ++i) { if (is_equal(argv[i], "-o")) { ++i; if (i >= argc) { @@ -53,7 +53,7 @@ if (is_equal(argv[1], "translate")) { unlink(output_filename.c_str()); return 1; } - // End subx translate + // End bootstrap translate return 0; } @@ -63,7 +63,7 @@ void transform(program& p) { } void print_translate_usage() { - cerr << "Usage: subx translate file1 file2 ... -o output\n"; + cerr << "Usage: bootstrap translate file1 file2 ... -o output\n"; } // write out a program to a bare-bones ELF file diff --git a/032---operands.cc b/032---operands.cc index 5d434319..f02ee3a5 100644 --- a/032---operands.cc +++ b/032---operands.cc @@ -21,7 +21,7 @@ put_new(Help, "instructions", "The complete list of operand types: mod, subop, r32 (register), rm32\n" "(register or memory), scale, index, base, disp8, disp16, disp32, imm8,\n" "imm32.\n" - "Each of these has its own help page. Try reading 'subx help mod' next.\n" + "Each of these has its own help page. Try reading 'bootstrap help mod' next.\n" ); :(before "End Help Contents") cerr << " instructions\n"; diff --git a/036labels.cc b/036labels.cc index 6f7fdbfe..aff7e08a 100644 --- a/036labels.cc +++ b/036labels.cc @@ -179,7 +179,7 @@ void compute_byte_indices_for_labels(const segment& code, map& } :(before "End Globals") -bool Dump_debug_info = false; // currently used only by 'subx translate' +bool Dump_debug_info = false; // currently used only by 'bootstrap translate' ofstream Labels_file; ofstream Source_lines_file; :(before "End Commandline Options") @@ -188,14 +188,14 @@ else if (is_equal(*arg, "--debug")) { // End --debug Settings } //: wait to open "labels" for writing until we're sure we aren't trying to read it -:(after "Begin subx translate") +:(after "Begin bootstrap translate") if (Dump_debug_info) { cerr << "saving address->label information to 'labels'\n"; Labels_file.open("labels"); cerr << "saving address->source information to 'source_lines'\n"; Source_lines_file.open("source_lines"); } -:(before "End subx translate") +:(before "End bootstrap translate") if (Dump_debug_info) { Labels_file.close(); Source_lines_file.close(); @@ -373,7 +373,7 @@ void test_duplicate_Entry_label() { } // This test could do with some refactoring. -// We're duplicating the flow inside `subx translate`, but without +// We're duplicating the flow inside `bootstrap translate`, but without // reading/writing files. // We can't just use run(string) because most of our tests allow programs // without 'Entry' labels, as a convenience. diff --git a/039debug.cc b/039debug.cc index e3dd8073..bb306b06 100644 --- a/039debug.cc +++ b/039debug.cc @@ -1,12 +1,12 @@ //:: Some helpers for debugging. -//: Load the 'map' file generated during 'subx --debug translate' when running -//: 'subx --debug --trace run'. +//: Load the 'map' file generated during 'bootstrap --debug translate' when running +//: 'bootstrap --trace run'. //: (It'll only affect the trace.) :(before "End Globals") -map Symbol_name; // used only by 'subx run' -map Source_line; // used only by 'subx run' +map Symbol_name; // used only by 'bootstrap run' +map Source_line; // used only by 'bootstrap run' :(before "End --debug Settings") load_labels(); load_source_lines(); diff --git a/052kernel-string-equal.subx b/052kernel-string-equal.subx index 57b5b1ec..f63ef9ed 100644 --- a/052kernel-string-equal.subx +++ b/052kernel-string-equal.subx @@ -8,8 +8,8 @@ # null-terminated 'kernel string' with a length-prefixed 'SubX string'. # # To run (from the subx directory): -# $ ./subx translate 05[0-2]*.subx -o /tmp/tmp52 -# $ ./subx run /tmp/tmp52 # runs a series of tests +# $ ./bootstrap translate 05[0-2]*.subx -o /tmp/tmp52 +# $ ./bootstrap run /tmp/tmp52 # runs a series of tests # ...... # all tests pass # # (We can't yet run the tests when given a "test" commandline argument, diff --git a/Readme.md b/Readme.md index b80be576..bc6f37cd 100644 --- a/Readme.md +++ b/Readme.md @@ -90,20 +90,20 @@ x86 machine code. Here's a program (`apps/ex1.subx`) that returns 42: You can generate tiny zero-dependency ELF binaries from SubX that run on Linux. ```sh - $ ./subx translate init.linux apps/ex1.subx -o apps/ex1 # on Linux or BSD or Mac + $ ./bootstrap translate init.linux apps/ex1.subx -o apps/ex1 # on Linux or BSD or Mac $ ./apps/ex1 # only on Linux $ echo $? 42 ``` -(Running `subx` requires a C++ compiler, transparently invoking it as +(Running `bootstrap` requires a C++ compiler, transparently invoking it as necessary.) You can run the generated binaries on an interpreter/VM for better error messages. ```sh - $ ./subx run apps/ex1 # on Linux or BSD or Mac + $ ./bootstrap run apps/ex1 # on Linux or BSD or Mac $ echo $? 42 ``` @@ -111,11 +111,11 @@ messages. Emulated runs can generate a trace that permits [time-travel debugging](https://github.com/akkartik/mu/blob/master/tools/browse_trace.readme.md). ```sh - $ ./subx --debug translate init.linux apps/factorial.subx -o apps/factorial + $ ./bootstrap --debug translate init.linux apps/factorial.subx -o apps/factorial saving address->label information to 'labels' saving address->source information to 'source_lines' - $ ./subx --debug --trace run apps/factorial + $ ./bootstrap --debug --trace run apps/factorial saving trace to 'last_run' $ tools/browse_trace last_run # text-mode debugger UI @@ -125,20 +125,20 @@ You can write tests for your programs. The entire stack is thoroughly covered by automated tests. SubX's tagline: tests before syntax. ```sh - $ ./subx test - $ ./subx run apps/factorial test + $ ./bootstrap test + $ ./bootstrap run apps/factorial test ``` You can use SubX to translate itself. For example, running natively on Linux: ```sh # generate translator phases using the C++ translator - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/hex.subx -o hex - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/survey.subx -o survey - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/pack.subx -o pack - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/assort.subx -o assort - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/dquotes.subx -o dquotes - $ ./subx translate init.linux 0*.subx apps/subx-params.subx apps/tests.subx -o tests + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/hex.subx -o hex + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/survey.subx -o survey + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/pack.subx -o pack + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/assort.subx -o assort + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/dquotes.subx -o dquotes + $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/tests.subx -o tests $ chmod +x hex survey pack assort dquotes tests # use the generated translator phases to translate SubX programs @@ -159,7 +159,7 @@ Or, running in a VM on other platforms (much slower): ```sh $ ./translate_subx_emulated init.linux ex1.subx # generates identical a.elf to above - $ ./subx run a.elf + $ ./bootstrap run a.elf $ echo $? 42 ``` @@ -382,8 +382,8 @@ rudimentary but hopefully still workable toolkit: * Generate a trace for the failing test while running your program in emulated mode (`subx run`): ``` - $ ./subx translate input.subx -o binary - $ ./subx --trace run binary arg1 arg2 2>trace + $ ./bootstrap translate input.subx -o binary + $ ./bootstrap --trace run binary arg1 arg2 2>trace ``` The ability to generate a trace is the essential reason for the existence of `subx run` mode. It gives far better visibility into program internals than @@ -392,8 +392,8 @@ rudimentary but hopefully still workable toolkit: * As a further refinement, it is possible to render label names in the trace by adding a second flag to both the `translate` and `run` commands: ``` - $ ./subx --debug translate input.subx -o binary - $ ./subx --debug --trace run binary arg1 arg2 2>trace + $ ./bootstrap --debug translate input.subx -o binary + $ ./bootstrap --debug --trace run binary arg1 arg2 2>trace ``` `subx --debug translate` emits a mapping from label to address in a file called `labels`. `subx --debug --trace run` reads in the `labels` file at @@ -731,10 +731,10 @@ a) Try running the tests: $ ./test_apps ``` -b) Check out the online help. Try typing just `./subx`, and then `./subx +b) Check out the online help. Try typing just `./bootstrap`, and then `./bootstrap help`. -c) Familiarize yourself with `./subx help opcodes`. You'll spend a lot of time +c) Familiarize yourself with `./bootstrap help opcodes`. You'll spend a lot of time with it. (It's also [in this repo](https://github.com/akkartik/mu/blob/master/opcodes).) [Here](https://lobste.rs/s/qglfdp/subx_minimalist_assembly_language_for#c_o9ddqk) are some tips on my setup for quickly finding the right opcode for any diff --git a/SubX-addressing-modes.md b/SubX-addressing-modes.md index 271de294..cdb056ee 100644 --- a/SubX-addressing-modes.md +++ b/SubX-addressing-modes.md @@ -107,8 +107,8 @@ reader's burden. Here's the order I've been using after opcodes: Try running this example now: ```sh -$ ./subx translate init.linux apps/ex3.subx -o apps/ex3 -$ ./subx run apps/ex3 +$ ./bootstrap translate init.linux apps/ex3.subx -o apps/ex3 +$ ./bootstrap run apps/ex3 $ echo $? 55 ``` diff --git a/bootstrap b/bootstrap new file mode 100755 index 00000000..b16da072 --- /dev/null +++ b/bootstrap @@ -0,0 +1,5 @@ +#!/bin/sh +# Run SubX VM, first compiling if necessary. +set -e + +./build && ./bootstrap_bin "$@" diff --git a/build b/build index 96cfc313..6a654fd0 100755 --- a/build +++ b/build @@ -3,9 +3,9 @@ # non-zero exit status only on error during building set -e # stop immediately on error -# [0-9]*.cc -> subx.cc -> subx_bin -# (layers) | | -# tangle $CXX +# [0-9]*.cc -> bootstrap.cc -> bootstrap_bin +# (layers) | | +# tangle $CXX # can also be called with a layer to only build until # $ ./build --until 050 @@ -87,17 +87,17 @@ older_than tools/tangle tools/tangle.cc && { } LAYERS=$(tools/enumerate --until $UNTIL_LAYER |grep '.cc$') -older_than subx.cc $LAYERS tools/enumerate tools/tangle && { +older_than bootstrap.cc $LAYERS tools/enumerate tools/tangle && { # no update here; rely on 'update' calls downstream - tools/tangle $LAYERS > subx.cc + tools/tangle $LAYERS > bootstrap.cc } -grep -h "^[^[:space:]#].*) {$" subx.cc |grep -v ":.*(" |sed 's/ {.*/;/' |update function_list -grep -h "^\s*void test_" subx.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' |update test_list -grep -h "^\s*void test_" subx.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list +grep -h "^[^[:space:]#].*) {$" bootstrap.cc |grep -v ":.*(" |sed 's/ {.*/;/' |update function_list +grep -h "^\s*void test_" bootstrap.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' |update test_list +grep -h "^\s*void test_" bootstrap.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list -older_than subx_bin subx.cc *_list && { - $CXX $CFLAGS subx.cc -o subx_bin +older_than bootstrap_bin bootstrap.cc *_list && { + $CXX $CFLAGS bootstrap.cc -o bootstrap_bin } exit 0 diff --git a/build_and_test_until b/build_and_test_until index 710e1d55..6f0782e1 100755 --- a/build_and_test_until +++ b/build_and_test_until @@ -15,4 +15,4 @@ then echo $1 > .until fi -./build --until $1 && ./subx_bin test $2 +./build --until $1 && ./bootstrap_bin test $2 diff --git a/clean b/clean index 693599a9..7a0eda83 100755 --- a/clean +++ b/clean @@ -2,7 +2,7 @@ set -e set -v -rm -rf subx.cc subx_bin* *_list +rm -rf bootstrap.cc bootstrap_bin* *_list rm -rf .until test $# -gt 0 && exit 0 # convenience: 'clean top-level' to leave subsidiary tools alone rm -rf tools/enumerate tools/tangle tools/*_list tools/*.dSYM diff --git a/run_one_test b/run_one_test index bc237c12..a67cfffa 100755 --- a/run_one_test +++ b/run_one_test @@ -20,4 +20,4 @@ fi set -e ./debug_translate init.linux $(echo $FILES) /tmp/run_one_test.subx -CFLAGS=$CFLAGS ./subx --debug --trace run a.elf +CFLAGS=$CFLAGS ./bootstrap --debug --trace run a.elf diff --git a/subx b/subx deleted file mode 100755 index 257e2f13..00000000 --- a/subx +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# Run SubX VM, first compiling if necessary. -set -e - -./build && ./subx_bin "$@" diff --git a/test_apps b/test_apps index eaf102e8..7b5f0bb1 100755 --- a/test_apps +++ b/test_apps @@ -28,10 +28,10 @@ echo "== translating and running using C++" # example programs echo ex1 -./subx translate init.$OS apps/ex1.subx -o apps/ex1 +./bootstrap translate init.$OS apps/ex1.subx -o apps/ex1 test "$1" = 'record' || git diff --exit-code apps/ex1 test $EMULATED && { - ./subx run apps/ex1 || ret=$? + ./bootstrap run apps/ex1 || ret=$? test $ret -eq 42 # life, the universe and everything } test $NATIVE && { @@ -40,10 +40,10 @@ test $NATIVE && { } echo ex2 -./subx translate init.$OS apps/ex2.subx -o apps/ex2 +./bootstrap translate init.$OS apps/ex2.subx -o apps/ex2 test "$1" = 'record' || git diff --exit-code apps/ex2 test $EMULATED && { - ./subx run apps/ex2 || ret=$? + ./bootstrap run apps/ex2 || ret=$? test $ret -eq 2 # 1 + 1 } test $NATIVE && { @@ -52,10 +52,10 @@ test $NATIVE && { } echo ex3 -./subx translate init.$OS apps/ex3.subx -o apps/ex3 +./bootstrap translate init.$OS apps/ex3.subx -o apps/ex3 test "$1" = 'record' || git diff --exit-code apps/ex3 test $EMULATED && { - ./subx run apps/ex3 || ret=$? + ./bootstrap run apps/ex3 || ret=$? test $ret -eq 55 # 1 + 2 + ... + 10 } test $NATIVE && { @@ -64,10 +64,10 @@ test $NATIVE && { } echo ex4 -./subx translate init.$OS apps/ex4.subx -o apps/ex4 +./bootstrap translate init.$OS apps/ex4.subx -o apps/ex4 test "$1" = 'record' || git diff --exit-code apps/ex4 test $EMULATED && { - echo a | ./subx run apps/ex4 >ex4.out || true + echo a | ./bootstrap run apps/ex4 >ex4.out || true test `cat ex4.out` = 'a' } test $NATIVE && { @@ -76,10 +76,10 @@ test $NATIVE && { } echo ex5 -./subx translate init.$OS apps/ex5.subx -o apps/ex5 +./bootstrap translate init.$OS apps/ex5.subx -o apps/ex5 test "$1" = 'record' || git diff --exit-code apps/ex5 test $EMULATED && { - echo a | ./subx run apps/ex5 >ex5.out || true + echo a | ./bootstrap run apps/ex5 >ex5.out || true test `cat ex5.out` = 'a' } test $NATIVE && { @@ -88,10 +88,10 @@ test $NATIVE && { } echo ex6 -./subx translate init.$OS apps/ex6.subx -o apps/ex6 +./bootstrap translate init.$OS apps/ex6.subx -o apps/ex6 test "$1" = 'record' || git diff --exit-code apps/ex6 test $EMULATED && { - ./subx run apps/ex6 >ex6.out || true + ./bootstrap run apps/ex6 >ex6.out || true test "`cat ex6.out`" = 'Hello, world!' } test $NATIVE && { @@ -100,10 +100,10 @@ test $NATIVE && { } echo ex7 -./subx translate init.$OS apps/ex7.subx -o apps/ex7 +./bootstrap translate init.$OS apps/ex7.subx -o apps/ex7 test "$1" = 'record' || git diff --exit-code apps/ex7 test $EMULATED && { - ./subx run apps/ex7 || ret=$? + ./bootstrap run apps/ex7 || ret=$? test $ret -eq 97 # 'a' } test $NATIVE && { @@ -112,10 +112,10 @@ test $NATIVE && { } echo ex8 -./subx translate init.$OS apps/ex8.subx -o apps/ex8 +./bootstrap translate init.$OS apps/ex8.subx -o apps/ex8 test "$1" = 'record' || git diff --exit-code apps/ex8 test $EMULATED && { - ./subx run apps/ex8 abcd || ret=$? + ./bootstrap run apps/ex8 abcd || ret=$? test $ret -eq 4 # length('abcd') } test $NATIVE && { @@ -124,10 +124,10 @@ test $NATIVE && { } echo ex9 -./subx translate init.$OS apps/ex9.subx -o apps/ex9 +./bootstrap translate init.$OS apps/ex9.subx -o apps/ex9 test "$1" = 'record' || git diff --exit-code apps/ex9 test $EMULATED && { - ./subx run apps/ex9 z x || ret=$? + ./bootstrap run apps/ex9 z x || ret=$? test $ret -eq 2 # 'z' - 'x' } test $NATIVE && { @@ -136,12 +136,12 @@ test $NATIVE && { } echo ex10 -./subx translate init.$OS apps/ex10.subx -o apps/ex10 +./bootstrap translate init.$OS apps/ex10.subx -o apps/ex10 test "$1" = 'record' || git diff --exit-code apps/ex10 test $EMULATED && { - ./subx run apps/ex10 abc abc || ret=$? + ./bootstrap run apps/ex10 abc abc || ret=$? test $ret -eq 1 # equal - ./subx run apps/ex10 abc abcd # 0; not equal + ./bootstrap run apps/ex10 abc abcd # 0; not equal } test $NATIVE && { apps/ex10 abc abc || ret=$? @@ -150,10 +150,10 @@ test $NATIVE && { } echo ex11 -./subx translate init.$OS apps/ex11.subx -o apps/ex11 +./bootstrap translate init.$OS apps/ex11.subx -o apps/ex11 test "$1" = 'record' || git diff --exit-code apps/ex11 test $EMULATED && { - ./subx run apps/ex11 + ./bootstrap run apps/ex11 echo } test $NATIVE && { @@ -162,20 +162,20 @@ test $NATIVE && { } echo ex12 -./subx translate init.$OS apps/ex12.subx -o apps/ex12 +./bootstrap translate init.$OS apps/ex12.subx -o apps/ex12 test "$1" = 'record' || git diff --exit-code apps/ex12 -test $EMULATED && ./subx run apps/ex12 # final byte of mmap'd address is well-nigh guaranteed to be 0 +test $EMULATED && ./bootstrap run apps/ex12 # final byte of mmap'd address is well-nigh guaranteed to be 0 test $NATIVE && apps/ex12 # Larger apps that use the standard library. echo factorial -./subx translate init.$OS 0*.subx apps/factorial.subx -o apps/factorial +./bootstrap translate init.$OS 0*.subx apps/factorial.subx -o apps/factorial test "$1" = 'record' || git diff --exit-code apps/factorial test $EMULATED && { - ./subx run apps/factorial || ret=$? + ./bootstrap run apps/factorial || ret=$? test $ret -eq 120 # factorial(5) - ./subx run apps/factorial test + ./bootstrap run apps/factorial test echo } test $NATIVE && { @@ -186,10 +186,10 @@ test $NATIVE && { } echo crenshaw2-1 -./subx translate init.$OS 0*.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1 +./bootstrap translate init.$OS 0*.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1 test "$1" = 'record' || git diff --exit-code apps/crenshaw2-1 test $EMULATED && { - ./subx run apps/crenshaw2-1 test + ./bootstrap run apps/crenshaw2-1 test echo } test $NATIVE && { @@ -198,10 +198,10 @@ test $NATIVE && { } echo crenshaw2-1b -./subx translate init.$OS 0*.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b +./bootstrap translate init.$OS 0*.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b test "$1" = 'record' || git diff --exit-code apps/crenshaw2-1b test $EMULATED && { - ./subx run apps/crenshaw2-1b test + ./bootstrap run apps/crenshaw2-1b test echo } test $NATIVE && { @@ -210,10 +210,10 @@ test $NATIVE && { } echo handle -./subx translate init.$OS 0*.subx apps/handle.subx -o apps/handle +./bootstrap translate init.$OS 0*.subx apps/handle.subx -o apps/handle test "$1" = 'record' || git diff --exit-code apps/handle test $EMULATED && { - ./subx run apps/handle > handle.out 2>&1 || true + ./bootstrap run apps/handle > handle.out 2>&1 || true grep -q 'lookup succeeded' handle.out || { echo "missing success test"; exit 1; } grep -q 'lookup failed' handle.out || { echo "missing failure test"; exit 1; } } @@ -228,10 +228,10 @@ test $NATIVE && { for phase in hex survey pack assort dquotes tests do echo $phase - ./subx translate init.$OS 0*.subx apps/subx-params.subx apps/$phase.subx -o apps/$phase + ./bootstrap translate init.$OS 0*.subx apps/subx-params.subx apps/$phase.subx -o apps/$phase test "$1" = 'record' || git diff --exit-code apps/hex test $EMULATED && { - ./subx run apps/$phase test + ./bootstrap run apps/$phase test echo } test $NATIVE && { @@ -246,10 +246,10 @@ done # to go beyond functionality of the C++ bootstrap. echo sigils -./subx translate init.$OS 0*.subx apps/subx-params.subx apps/sigils.subx -o apps/sigils +./bootstrap translate init.$OS 0*.subx apps/subx-params.subx apps/sigils.subx -o apps/sigils [ "$1" != record ] && git diff --exit-code apps/sigils test $EMULATED && { - ./subx run apps/sigils test + ./bootstrap run apps/sigils test echo } test `uname` = 'Linux' && { @@ -259,10 +259,10 @@ test `uname` = 'Linux' && { echo calls cat init.$OS 0*.subx apps/subx-params.subx apps/calls.subx | apps/sigils > a.sigils -./subx translate a.sigils -o apps/calls +./bootstrap translate a.sigils -o apps/calls [ "$1" != record ] && git diff --exit-code apps/calls test $EMULATED && { - ./subx run apps/calls test + ./bootstrap run apps/calls test echo } test `uname` = 'Linux' && { @@ -272,10 +272,10 @@ test `uname` = 'Linux' && { echo braces cat init.$OS 0*.subx apps/subx-params.subx apps/braces.subx | apps/calls | apps/sigils > a.sigils -./subx translate a.sigils -o apps/braces +./bootstrap translate a.sigils -o apps/braces [ "$1" != record ] && git diff --exit-code apps/braces test $EMULATED && { - ./subx run apps/braces test + ./bootstrap run apps/braces test echo } test `uname` = 'Linux' && { @@ -285,10 +285,10 @@ test `uname` = 'Linux' && { echo mu cat init.$OS 0*.subx apps/mu.subx | apps/braces | apps/calls | apps/sigils > a.sigils -./subx translate a.sigils -o apps/mu +./bootstrap translate a.sigils -o apps/mu [ "$1" != record ] && git diff --exit-code apps/mu test $EMULATED && { - ./subx run apps/mu test + ./bootstrap run apps/mu test echo } test `uname` = 'Linux' && { diff --git a/test_layers b/test_layers index bf487c09..568a0f21 100755 --- a/test_layers +++ b/test_layers @@ -21,8 +21,8 @@ done for f in [0-9]*.subx do echo "=== $f" - ./subx translate init.linux $(tools/enumerate --until $f |grep '\.subx$') -o a.elf - ./subx run a.elf test + ./bootstrap translate init.linux $(tools/enumerate --until $f |grep '\.subx$') -o a.elf + ./bootstrap run a.elf test echo test `uname` = 'Linux' && { chmod +x a.elf diff --git a/translate_subx_debug b/translate_subx_debug index f5754f37..d9038f39 100755 --- a/translate_subx_debug +++ b/translate_subx_debug @@ -26,6 +26,6 @@ cat a.braces |apps/calls > a.calls echo " sigils" cat a.calls |apps/sigils > a.sigils -subx --debug translate a.sigils -o a.elf +./bootstrap --debug translate a.sigils -o a.elf chmod +x a.elf diff --git a/translate_subx_emulated b/translate_subx_emulated index 639d924e..0eab2c32 100755 --- a/translate_subx_emulated +++ b/translate_subx_emulated @@ -21,30 +21,30 @@ set -e ./build echo " braces" -cat $* |./subx_bin run apps/braces > a.braces +cat $* |./bootstrap_bin run apps/braces > a.braces echo " calls" -cat a.braces |./subx_bin run apps/calls > a.calls +cat a.braces |./bootstrap_bin run apps/calls > a.calls echo " sigils" -cat a.calls |./subx_bin run apps/sigils > a.sigils +cat a.calls |./bootstrap_bin run apps/sigils > a.sigils echo " tests" -cat a.sigils |./subx_bin run apps/tests > a.tests +cat a.sigils |./bootstrap_bin run apps/tests > a.tests echo " dquotes" -cat a.tests |./subx_bin run apps/dquotes > a.dquotes +cat a.tests |./bootstrap_bin run apps/dquotes > a.dquotes echo " assort" -cat a.dquotes |./subx_bin run apps/assort > a.assort +cat a.dquotes |./bootstrap_bin run apps/assort > a.assort echo " pack" -cat a.assort |./subx_bin run apps/pack > a.pack +cat a.assort |./bootstrap_bin run apps/pack > a.pack echo " survey" -cat a.pack |./subx_bin run apps/survey > a.survey +cat a.pack |./bootstrap_bin run apps/survey > a.survey echo " hex" -cat a.survey |./subx_bin run apps/hex > a.elf +cat a.survey |./bootstrap_bin run apps/hex > a.elf chmod +x a.elf -- cgit 1.4.1-2-gfad0 n> ^
1
2
3
4
5
6
7
8
9
10