Browse Source

5485 - promote SubX to top-level

main
Kartik Agaram 3 years ago
parent
commit
6e1eeeebfb
  1. 26
      .travis.yml
  2. 34
      000organization.cc
  3. 144
      001help.cc
  4. 7
      002test.cc
  5. 65
      003trace.cc
  6. 7
      003trace.test.cc
  7. 0
      010---vm.cc
  8. 0
      011run.cc
  9. 0
      012elf.cc
  10. 0
      013direct_addressing.cc
  11. 0
      014indirect_addressing.cc
  12. 0
      015immediate_addressing.cc
  13. 0
      016index_addressing.cc
  14. 0
      017jump_disp8.cc
  15. 0
      018jump_disp32.cc
  16. 0
      019functions.cc
  17. 0
      020syscalls.cc
  18. 0
      021byte_addressing.cc
  19. 0
      022div.cc
  20. 0
      028translate.cc
  21. 0
      029transforms.cc
  22. 0
      030---operands.cc
  23. 0
      031check_operands.cc
  24. 0
      032check_operand_bounds.cc
  25. 0
      034compute_segment_address.cc
  26. 0
      035labels.cc
  27. 0
      036global_variables.cc
  28. 0
      038---literal_strings.cc
  29. 0
      039debug.cc
  30. 0
      040---tests.cc
  31. 0
      049memory_layout.subx
  32. 0
      050_write.subx
  33. 0
      051test.subx
  34. 0
      052kernel-string-equal.subx
  35. 0
      053new-segment.subx
  36. 0
      054string-equal.subx
  37. 0
      055stream.subx
  38. 0
      056trace.subx
  39. 0
      057write.subx
  40. 0
      058stream-equal.subx
  41. 0
      059stop.subx
  42. 0
      060read.subx
  43. 0
      061read-byte.subx
  44. 0
      062write-stream.subx
  45. 0
      063error.subx
  46. 0
      064write-byte.subx
  47. 0
      065write-buffered.subx
  48. 0
      066print-int.subx
  49. 0
      067parse-hex.subx
  50. 0
      068error-byte.subx
  51. 0
      069allocate.subx
  52. 0
      070new-stream.subx
  53. 0
      071read-line.subx
  54. 0
      072slice.subx
  55. 0
      073next-token.subx
  56. 0
      074print-int-decimal.subx
  57. 0
      075array-equal.subx
  58. 0
      076zero-out.subx
  59. 0
      077slurp.subx
  60. 0
      100index
  61. 1062
      Readme.md
  62. 0
      apps/Readme.md
  63. 0
      apps/assort
  64. 0
      apps/assort.subx
  65. 0
      apps/crenshaw2-1
  66. 0
      apps/crenshaw2-1.subx
  67. 0
      apps/crenshaw2-1b
  68. 0
      apps/crenshaw2-1b.subx
  69. 0
      apps/dquotes
  70. 0
      apps/dquotes.subx
  71. 0
      apps/factorial
  72. 0
      apps/factorial.subx
  73. 0
      apps/handle
  74. 0
      apps/handle.subx
  75. 0
      apps/hex
  76. 0
      apps/hex.subx
  77. 0
      apps/pack
  78. 0
      apps/pack.subx
  79. 0
      apps/subx-common.subx
  80. 0
      apps/survey
  81. 0
      apps/survey.subx
  82. 0
      apps/tests
  83. 0
      apps/tests.subx
  84. 38
      arc/.traces/add
  85. 14
      arc/.traces/add-literal
  86. 0
      arc/.traces/after
  87. 0
      arc/.traces/after-multiple
  88. 14
      arc/.traces/and-literal
  89. 43
      arc/.traces/arg-record
  90. 53
      arc/.traces/arg-record-indirect
  91. 46
      arc/.traces/array-bounds-check
  92. 100
      arc/.traces/array-copy-indirect-scoped
  93. 0
      arc/.traces/before
  94. 0
      arc/.traces/before-after
  95. 10
      arc/.traces/before-after-any-order
  96. 10
      arc/.traces/before-after-braces
  97. 0
      arc/.traces/before-after-independent
  98. 0
      arc/.traces/before-after-multiple
  99. 0
      arc/.traces/before-multiple
  100. 0
      arc/.traces/before-scoped
  101. Some files were not shown because too many files have changed in this diff Show More

26
.travis.yml

@ -14,30 +14,8 @@ addons:
# matrix so we don't time out on Travis
matrix:
include:
# primary prototype
- env: COMMAND=./subx/test_layers
- env: COMMAND=./subx/test_apps
# other directories
- env: COMMAND=./test_layers CXX=clang++ START=000 END=040
- env: COMMAND=./test_layers CXX=clang++ START=040 END=055
- env: COMMAND=./test_layers CXX=clang++ START=055 END=065
- env: COMMAND=./test_layers CXX=clang++ START=065 END=070
- env: COMMAND=./test_layers CXX=clang++ START=070 END=075
- env: COMMAND=./test_layers CXX=clang++ START=075 END=080
- env: COMMAND=./test_layers CXX=clang++ START=080 END=085
- env: COMMAND=./test_layers CXX=clang++ START=085 END=090
- env: COMMAND=./test_layers CXX=clang++ START=090 END=095
- env: COMMAND=./test_layers CXX=clang++ START=095 END=999 # overflow; will start timing out if we add too many layers
- env: COMMAND=./test_layers CXX=clang++ START=chessboard
- env: COMMAND=./test_layers CXX=clang++ START=edit
- env: COMMAND=./test_layers CXX=clang++ START=edit2
- env: COMMAND=./test_layers CXX=clang++ START=edit3
- env: COMMAND=./test_layers CXX=clang++ START=edit4
- env: COMMAND=./test_layers CXX=g++ START=one-off # minimal testing for gcc
# other build scripts
- env: COMMAND=./test_layers BUILD=build0 START=one-off
- env: COMMAND=./test_layers BUILD=build1 START=one-off
- env: COMMAND=./test_layers BUILD=build2 START=one-off
- env: COMMAND=./test_layers
- env: COMMAND=./test_apps
script:
- $COMMAND $START $END

34
000organization.cc

@ -94,7 +94,7 @@
// Types
// End Types
// Function prototypes are auto-generated in the 'build*' scripts; define your
// Function prototypes are auto-generated in the 'build' script; define your
// functions in any order. Just be sure to declare each function header all on
// one line, ending with the '{'. Our auto-generation scripts are too minimal
// and simple-minded to handle anything else.
@ -103,7 +103,7 @@
// Globals
//
// All statements in this section should always define a single variable on a
// single line. The 'build*' scripts will simple-mindedly auto-generate extern
// single line. The 'build' script will simple-mindedly auto-generate extern
// declarations for them. Remember to define (not just declare) constants with
// extern linkage in this section, since C++ global constants have internal
// linkage by default.
@ -112,25 +112,51 @@
int main(int argc, char* argv[]) {
atexit(reset);
// we require a 32-bit little-endian system
assert(sizeof(int) == 4);
assert(sizeof(float) == 4);
assert_little_endian();
// End One-time Setup
// Commandline Parsing
// End Commandline Parsing
return 0; // End Main
// End Main
return 0;
}
// Unit Tests
// End Unit Tests
//: our first directive; insert the following header at the start of the program
//: our first directive; insert the following headers at the start of the program
:(before "End Includes")
#include <assert.h>
#include <stdlib.h>
//: Without directives or with the :(code) directive, lines get added at the
//: end.
//:
//: Regardless of where functions are defined, we can call them anywhere we
//: like as long as we format the function header in a specific way: put it
//: all on a single line without indent, end the line with ') {' and no
//: trailing whitespace. As long as functions uniformly start this way, our
//: 'build' script contains a little command to automatically generate
//: declarations for them.
:(code)
void reset() {
// End Reset
}
void assert_little_endian() {
const int x = 1;
const char* y = reinterpret_cast<const char*>(&x);
if (*y != 1) {
cerr << "SubX requires a little-endian processor. Do you have Intel (or AMD or Atom) inside?\n";
exit(1);
}
}
:(before "End Includes")
#include<iostream>
using std::cerr;

144
001help.cc

@ -5,54 +5,13 @@
if (argc <= 1 || is_equal(argv[1], "--help")) {
//: this is the functionality later layers will provide
// currently no automated tests for commandline arg parsing
if (argc <= 1) {
cerr << "Please provide a Mu program to run.\n"
<< "\n";
}
cerr << "Usage:\n"
<< " mu [options] [test] [files]\n"
<< "or:\n"
<< " mu [options] [test] [files] -- [ingredients for function/recipe 'main']\n"
<< "Square brackets surround optional arguments.\n"
<< "\n"
<< "Examples:\n"
<< " To load files and run 'main':\n"
<< " mu file1.mu file2.mu ...\n"
<< " To run 'main' and dump a trace of all operations at the end:\n"
<< " mu --trace file1.mu file2.mu ...\n"
<< " To run all tests:\n"
<< " mu test\n"
<< " To load files and then run all tests:\n"
<< " mu test file1.mu file2.mu ...\n"
<< " To run a single Mu scenario:\n"
<< " mu test file1.mu file2.mu ... scenario\n"
<< " To run a single Mu scenario and dump a trace at the end:\n"
<< " mu --trace test file1.mu file2.mu ... scenario\n"
<< " To load files and run only the tests in explicitly loaded files (for apps):\n"
<< " mu --test-only-app test file1.mu file2.mu ...\n"
<< " To load all files with a numeric prefix in a directory:\n"
<< " mu directory1 directory2 ...\n"
<< " You can test directories just like files.\n"
<< " mu test directory1 directory2 ...\n"
<< " To pass ingredients to a mu program, provide them after '--':\n"
<< " mu file_or_dir1 file_or_dir2 ... -- ingredient1 ingredient2 ...\n"
<< " To see where a mu program is spending its time:\n"
<< " mu --profile file_or_dir1 file_or_dir2 ...\n"
<< " this slices and dices time spent in various profile.* output files\n"
<< " To print out the trace to stderr:\n"
<< " mu --dump file1.mu file2.mu ...\n"
<< " this is handy when you want to see sandboxed traces alongside the main one\n"
<< "\n"
<< " To browse a trace generated by a previous run:\n"
<< " mu browse-trace file\n"
;
cerr << get(Help, "usage");
return 0;
}
//: Support for option parsing.
//: Options always begin with '--' and are always the first arguments. An
//: option will never follow a non-option.
:(before "End Commandline Parsing")
char** arg = &argv[1];
while (argc > 1 && starts_with(*arg, "--")) {
if (false)
@ -63,15 +22,76 @@ while (argc > 1 && starts_with(*arg, "--")) {
--argc; ++argv; ++arg;
}
//:: Helper function used by the above fragment of code (and later layers too,
//:: who knows?).
//: The :(code) directive appends function definitions to the end of the
//: project. Regardless of where functions are defined, we can call them
//: anywhere we like as long as we format the function header in a specific
//: way: put it all on a single line without indent, end the line with ') {'
//: and no trailing whitespace. As long as functions uniformly start this
//: way, our 'build*' scripts contain a little command to automatically
//: generate declarations for them.
if (is_equal(argv[1], "help")) {
if (argc == 2) {
cerr << "help on what?\n";
help_contents();
return 0;
}
string key(argv[2]);
// End Help Special-cases(key)
if (contains_key(Help, key)) {
cerr << get(Help, key);
return 0;
}
else {
cerr << "No help found for '" << key << "'\n";
help_contents();
cerr << "Please check your command for typos.\n";
return 1;
}
}
:(code)
void help_contents() {
cerr << "Available top-level topics:\n";
cerr << " usage\n";
// End Help Contents
}
:(before "End Globals")
map<string, string> Help;
:(before "End Includes")
#include <map>
using std::map;
:(before "End One-time Setup")
init_help();
:(code)
void init_help() {
put(Help, "usage",
"Welcome to SubX, a better way to program in machine code.\n"
"SubX uses a subset of the x86 instruction set. SubX programs will run\n"
"without modification on Linux computers.\n"
"It provides a better experience and better error messages than\n"
"programming directly in machine code, but you have to stick to the\n"
"instructions it supports.\n"
"\n"
"== Ways to invoke subx\n"
"- Run tests:\n"
" subx test\n"
"- See this message:\n"
" subx --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 <output ELF binary>\n"
"- Run a SubX binary using SubX itself (for better error messages):\n"
" subx run <ELF binary>\n"
"\n"
"== Debugging aids\n"
"- Add '--trace' to any of these commands to save a trace.\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"
" more informative.\n"
"\n"
"Options starting with '--' must always come before any other arguments.\n"
"\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"
);
// End Help Texts
}
:(code)
bool is_equal(char* s, const char* lit) {
return strncmp(s, lit, strlen(lit)) == 0;
@ -164,7 +184,7 @@ void dump_and_exit(int sig, siginfo_t* /*unused*/, void* /*unused*/) {
switch (sig) {
case SIGABRT:
#ifndef __APPLE__
cerr << "SIGABRT: might be an integer overflow if it wasn't an assert() failure or exception\n";
cerr << "SIGABRT: might be an integer overflow if it wasn't an assert() failure\n";
_Exit(1);
#endif
break;
@ -213,18 +233,23 @@ int feenableexcept(unsigned int excepts) {
// from http://stackoverflow.com/questions/152643/idiomatic-c-for-reading-from-a-const-map
template<typename T> typename T::mapped_type& get(T& map, typename T::key_type const& key) {
typename T::iterator iter(map.find(key));
assert(iter != map.end());
if (iter == map.end()) {
cerr << "get couldn't find key '" << key << "'\n";
assert(iter != map.end());
}
return iter->second;
}
template<typename T> typename T::mapped_type const& get(const T& map, typename T::key_type const& key) {
typename T::const_iterator iter(map.find(key));
assert(iter != map.end());
if (iter == map.end()) {
cerr << "get couldn't find key '" << key << "'\n";
assert(iter != map.end());
}
return iter->second;
}
template<typename T> typename T::mapped_type const& put(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {
// map[key] requires mapped_type to have a zero-arg (default) constructor
map.insert(std::make_pair(key, value)).first->second = value;
return value;
map[key] = value;
return map[key];
}
template<typename T> bool contains_key(T& map, typename T::key_type const& key) {
return map.find(key) != map.end();
@ -232,6 +257,11 @@ template<typename T> bool contains_key(T& map, typename T::key_type const& key)
template<typename T> typename T::mapped_type& get_or_insert(T& map, typename T::key_type const& key) {
return map[key];
}
template<typename T> typename T::mapped_type const& put_new(T& map, typename T::key_type const& key, typename T::mapped_type const& value) {
assert(map.find(key) == map.end());
map[key] = value;
return map[key];
}
//: The contract: any container that relies on get_or_insert should never call
//: contains_key.

7
002test.cc

@ -70,6 +70,13 @@ if (Run_tests) {
return 0;
}
:(after "End Main")
//: Raise other unrecognized sub-commands as errors.
//: We couldn't do this until now because we want `./subx test` to always
//: succeed, no matter how many layers are included in the build.
cerr << "nothing to do\n";
return 1;
:(code)
void run_test(size_t i) {
if (i >= sizeof(Tests)/sizeof(Tests[0])) {

65
003trace.cc

@ -129,6 +129,21 @@ struct trace_line {
}
};
string unescape_newline(string& s) {
std::stringstream ss;
for (int i = 0; i < SIZE(s); ++i) {
if (s.at(i) == '\n')
ss << "\\n";
else
ss << s.at(i);
}
return ss.str();
}
void dump_trace_line(ostream& s, trace_line& t) {
s << std::setw(4) << t.depth << ' ' << t.label << ": " << unescape_newline(t.contents) << '\n';
}
//: Starting a new trace line.
:(before "End trace_stream Methods")
ostream& stream(string label) {
@ -140,6 +155,7 @@ ostream& stream(int depth, string label) {
curr_stream = new ostringstream;
curr_label = label;
curr_depth = depth;
(*curr_stream) << std::hex; // printing addresses is the common case
return *curr_stream;
}
@ -152,6 +168,15 @@ ostream& operator<<(ostream& os, end /*unused*/) {
return os;
}
//: Fatal error.
:(before "End Types")
struct die {};
:(code)
ostream& operator<<(ostream& /*unused*/, die /*unused*/) {
if (Trace_stream) Trace_stream->newline();
exit(1);
}
:(before "End trace_stream Methods")
void newline();
:(code)
@ -163,7 +188,7 @@ void trace_stream::newline() {
// maybe incrementally dump trace
trace_line& t = past_lines.back();
if (should_incrementally_print_trace()) {
cerr << std::setw(4) << t.depth << ' ' << t.label << ": " << t.contents << '\n';
dump_trace_line(cerr, t);
}
// End trace Commit
}
@ -195,21 +220,29 @@ lease_tracer::~lease_tracer() {
Trace_stream = NULL;
}
//:: == Errors using traces
//:: == Errors and warnings using traces
:(before "End Includes")
#define raise (!Trace_stream ? (scroll_to_bottom_and_close_console(),++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
#define raise (!Trace_stream ? (++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Error_depth, "error"))
#define warn (!Trace_stream ? (++Trace_errors,cerr) /*do print*/ : Trace_stream->stream(Warn_depth, "warn"))
//: Print errors to the screen by default.
//: Print errors and warnings to the screen by default.
:(before "struct trace_stream") // include constants in all cleaved compilation units
const int Error_depth = 0;
const int Warn_depth = 1;
:(before "End Globals")
int Hide_errors = false; // if set, don't print errors to screen
int Hide_errors = false; // if set, don't print errors or warnings to screen
int Hide_warnings = false; // if set, don't print warnings to screen
:(before "End Reset")
Hide_errors = false;
Hide_warnings = false;
//: Never dump warnings in tests
:(before "End Test Setup")
Hide_warnings = true;
:(code)
bool trace_stream::should_incrementally_print_trace() {
if (!Hide_errors && curr_depth == Error_depth) return true;
if (!Hide_warnings && !Hide_errors && curr_depth == Warn_depth) return true;
// End Incremental Trace Print Conditions
return false;
}
@ -236,20 +269,6 @@ bool trace_contains_errors() {
#define assert_for_now assert
#define raise_for_now raise
//: Automatically close the console in some situations.
:(before "End One-time Setup")
atexit(scroll_to_bottom_and_close_console);
:(code)
void scroll_to_bottom_and_close_console() {
if (!tb_is_active()) return;
// leave the screen in a relatively clean state
tb_set_cursor(tb_width()-1, tb_height()-1);
cout << "\r\n";
tb_shutdown();
}
:(before "End Includes")
#include "termbox/termbox.h"
//:: == Other assertions on traces
//: Primitives:
//: - CHECK_TRACE_CONTENTS(lines)
@ -306,7 +325,8 @@ bool check_trace_contents(string FUNCTION, string FILE, int LINE, string expecte
split_label_contents(expected_lines.at(curr_expected_line), &label, &contents);
for (vector<trace_line>::iterator p = Trace_stream->past_lines.begin(); p != Trace_stream->past_lines.end(); ++p) {
if (label != p->label) continue;
if (contents != trim(p->contents)) continue;
string t = trim(p->contents);
if (contents != unescape_newline(t)) continue;
++curr_expected_line;
while (curr_expected_line < SIZE(expected_lines) && expected_lines.at(curr_expected_line).empty())
++curr_expected_line;
@ -426,7 +446,6 @@ vector<string> split_first(string s, string delim) {
ofstream Trace_file;
:(before "End Commandline Options(*arg)")
else if (is_equal(*arg, "--trace")) {
Trace_stream = new trace_stream;
cerr << "saving trace to 'last_run'\n";
Trace_file.open("last_run");
// Add a dummy line up top; otherwise the `browse_trace` tool currently has
@ -435,7 +454,7 @@ else if (is_equal(*arg, "--trace")) {
}
:(before "End trace Commit")
if (Trace_file) {
Trace_file << std::setw(4) << t.depth << ' ' << t.label << ": " << t.contents << '\n';
dump_trace_line(Trace_file, t);
}
:(before "End One-time Setup")
atexit(cleanup_main);
@ -452,7 +471,7 @@ string readable_contents(string label) {
label = trim(label);
for (vector<trace_line>::iterator p = past_lines.begin(); p != past_lines.end(); ++p)
if (label.empty() || label == p->label)
output << std::setw(4) << p->depth << ' ' << p->label << ": " << p->contents << '\n';
dump_trace_line(output, *p);
return output.str();
}

7
003trace.test.cc

@ -64,10 +64,17 @@ void test_trace_count_ignores_trailing_whitespace() {
CHECK_EQ(trace_count("test layer 1", "foo"), 1);
}
void test_trace_unescapes_newlines() {
trace("test layer 1") << "f\no\no\n" << end();
CHECK_TRACE_CONTENTS("test layer 1: f\\no\\no");
}
// pending: DUMP tests
// pending: readable_contents() adds newline if necessary.
// pending: raise also prints to stderr.
// pending: raise doesn't print to stderr if Hide_errors is set.
// pending: warn doesn't print to stderr if Hide_errors is set.
// pending: warn doesn't print to stderr if Hide_warnings is set.
// pending: raise doesn't have to be saved if Hide_errors is set, just printed.
// pending: raise prints to stderr if Trace_stream is NULL.
// pending: raise prints to stderr if Trace_stream is NULL even if Hide_errors is set.

0
subx/010---vm.cc → 010---vm.cc

0
subx/011run.cc → 011run.cc

0
subx/012elf.cc → 012elf.cc

0
subx/013direct_addressing.cc → 013direct_addressing.cc

0
subx/014indirect_addressing.cc → 014indirect_addressing.cc

0
subx/015immediate_addressing.cc → 015immediate_addressing.cc

0
subx/016index_addressing.cc → 016index_addressing.cc

0
subx/017jump_disp8.cc → 017jump_disp8.cc

0
subx/018jump_disp32.cc → 018jump_disp32.cc

0
subx/019functions.cc → 019functions.cc

0
subx/020syscalls.cc → 020syscalls.cc

0
subx/021byte_addressing.cc → 021byte_addressing.cc

0
subx/022div.cc → 022div.cc

0
subx/028translate.cc → 028translate.cc

0
subx/029transforms.cc → 029transforms.cc

0
subx/030---operands.cc → 030---operands.cc

0
subx/031check_operands.cc → 031check_operands.cc

0
subx/032check_operand_bounds.cc → 032check_operand_bounds.cc

0
subx/034compute_segment_address.cc → 034compute_segment_address.cc

0
subx/035labels.cc → 035labels.cc

0
subx/036global_variables.cc → 036global_variables.cc

0
subx/038---literal_strings.cc → 038---literal_strings.cc

0
subx/039debug.cc → 039debug.cc

0
subx/040---tests.cc → 040---tests.cc

0
subx/049memory_layout.subx → 049memory_layout.subx

0
subx/050_write.subx → 050_write.subx

0
subx/051test.subx → 051test.subx

0
subx/052kernel-string-equal.subx → 052kernel-string-equal.subx

0
subx/053new-segment.subx → 053new-segment.subx

0
subx/054string-equal.subx → 054string-equal.subx

0
subx/055stream.subx → 055stream.subx

0
subx/056trace.subx → 056trace.subx

0
subx/057write.subx → 057write.subx

0
subx/058stream-equal.subx → 058stream-equal.subx

0
subx/059stop.subx → 059stop.subx

0
subx/060read.subx → 060read.subx

0
subx/061read-byte.subx → 061read-byte.subx

0
subx/062write-stream.subx → 062write-stream.subx

0
subx/063error.subx → 063error.subx

0
subx/064write-byte.subx → 064write-byte.subx

0
subx/065write-buffered.subx → 065write-buffered.subx

0
subx/066print-int.subx → 066print-int.subx

0
subx/067parse-hex.subx → 067parse-hex.subx

0
subx/068error-byte.subx → 068error-byte.subx

0
subx/069allocate.subx → 069allocate.subx

0
subx/070new-stream.subx → 070new-stream.subx

0
subx/071read-line.subx → 071read-line.subx

0
subx/072slice.subx → 072slice.subx

0
subx/073next-token.subx → 073next-token.subx

0
subx/074print-int-decimal.subx → 074print-int-decimal.subx

0
subx/075array-equal.subx → 075array-equal.subx

0
subx/076zero-out.subx → 076zero-out.subx

0
subx/077slurp.subx → 077slurp.subx

0
subx/100index → 100index

1062
Readme.md

File diff suppressed because it is too large Load Diff

0
subx/apps/Readme.md → apps/Readme.md

0
subx/apps/assort → apps/assort

0
subx/apps/assort.subx → apps/assort.subx

0
subx/apps/crenshaw2-1 → apps/crenshaw2-1

0
subx/apps/crenshaw2-1.subx → apps/crenshaw2-1.subx

0
subx/apps/crenshaw2-1b → apps/crenshaw2-1b

0
subx/apps/crenshaw2-1b.subx → apps/crenshaw2-1b.subx

0
subx/apps/dquotes → apps/dquotes

0
subx/apps/dquotes.subx → apps/dquotes.subx

0
subx/apps/factorial → apps/factorial

0
subx/apps/factorial.subx → apps/factorial.subx

0
subx/apps/handle → apps/handle

0
subx/apps/handle.subx → apps/handle.subx

0
subx/apps/hex → apps/hex

0
subx/apps/hex.subx → apps/hex.subx

0
subx/apps/pack → apps/pack

0
subx/apps/pack.subx → apps/pack.subx

0
subx/apps/subx-common.subx → apps/subx-common.subx

0
subx/apps/survey → apps/survey

0
subx/apps/survey.subx → apps/survey.subx

0
subx/apps/tests → apps/tests

0
subx/apps/tests.subx → apps/tests.subx

38
arc/.traces/add

@ -1,38 +0,0 @@
c{0: 0 (((1 integer)) <- ((copy)) ((1 literal))) -- nil
c{0: 1 (((2 integer)) <- ((copy)) ((3 literal))) -- nil
c{0: 2 (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((1 literal)))
c{1: 1 ✓ (((2 integer)) <- ((copy)) ((3 literal)))
c{1: 2 ✓ (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((copy)) ((1 literal))) nil nil
cn0: checking arg ((1 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 integer)) <- ((copy)) ((3 literal))) nil nil
cn0: checking arg ((3 literal))
cn0: checking oarg ((2 integer))
maybe-add: ((2 integer))
cn0: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) nil nil
cn0: checking arg ((1 integer))
maybe-add: ((1 integer))
cn0: checking arg ((2 integer))
maybe-add: ((2 integer))
cn0: checking oarg ((3 integer))
maybe-add: ((3 integer))
cn1: (((1 integer)) <- ((copy)) ((1 literal)))
cn1: (((2 integer)) <- ((copy)) ((3 literal)))
cn1: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
schedule: main
run: main 0: (((1 integer)) <- ((copy)) ((1 literal)))
run: main 0: 1 => ((1 integer))
mem: ((1 integer)): 1 <= 1
run: main 1: (((2 integer)) <- ((copy)) ((3 literal)))
run: main 1: 3 => ((2 integer))
mem: ((2 integer)): 2 <= 3
run: main 2: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
mem: ((1 integer)) => 1
mem: ((2 integer)) => 3
run: main 2: 4 => ((3 integer))
mem: ((3 integer)): 3 <= 4
schedule: done with routine nil

14
arc/.traces/add-literal

@ -1,14 +0,0 @@
c{0: 0 (((1 integer)) <- ((add)) ((2 literal)) ((3 literal))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((add)) ((2 literal)) ((3 literal)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((add)) ((2 literal)) ((3 literal))) nil nil
cn0: checking arg ((2 literal))
cn0: checking arg ((3 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn1: (((1 integer)) <- ((add)) ((2 literal)) ((3 literal)))
schedule: main
run: main 0: (((1 integer)) <- ((add)) ((2 literal)) ((3 literal)))
run: main 0: 5 => ((1 integer))
mem: ((1 integer)): 1 <= 5
schedule: done with routine nil

0
arc/.traces/after

0
arc/.traces/after-multiple

14
arc/.traces/and-literal

@ -1,14 +0,0 @@
c{0: 0 (((1 boolean)) <- ((and)) ((t literal)) ((nil literal))) -- nil
c{1: 0 ✓ (((1 boolean)) <- ((and)) ((t literal)) ((nil literal)))
cn0: convert-names in main
cn0: (((1 boolean)) <- ((and)) ((t literal)) ((nil literal))) nil nil
cn0: checking arg ((t literal))
cn0: checking arg ((nil literal))
cn0: checking oarg ((1 boolean))
maybe-add: ((1 boolean))
cn1: (((1 boolean)) <- ((and)) ((t literal)) ((nil literal)))
schedule: main
run: main 0: (((1 boolean)) <- ((and)) ((t literal)) ((nil literal)))
run: main 0: nil => ((1 boolean))
mem: ((1 boolean)): 1 <= nil
schedule: done with routine nil

43
arc/.traces/arg-record

@ -1,43 +0,0 @@
c{0: 0 (((1 integer)) <- ((copy)) ((34 literal))) -- nil
c{0: 1 (((2 boolean)) <- ((copy)) ((nil literal))) -- nil
c{0: 2 (((test1)) ((1 integer-boolean-pair))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((34 literal)))
c{1: 1 ✓ (((2 boolean)) <- ((copy)) ((nil literal)))
c{1: 2 ✓ (((test1)) ((1 integer-boolean-pair)))
c{0: 0 (((4 integer-boolean-pair)) <- ((next-input))) -- nil
c{1: 0 ✓ (((4 integer-boolean-pair)) <- ((next-input)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((copy)) ((34 literal))) nil nil
cn0: checking arg ((34 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 boolean)) <- ((copy)) ((nil literal))) nil nil
cn0: checking arg ((nil literal))
cn0: checking oarg ((2 boolean))
maybe-add: ((2 boolean))
cn0: (((test1)) ((1 integer-boolean-pair))) nil nil
cn0: checking arg ((1 integer-boolean-pair))
maybe-add: ((1 integer-boolean-pair))
cn0: convert-names in test1
cn0: (((4 integer-boolean-pair)) <- ((next-input))) nil nil
cn0: checking oarg ((4 integer-boolean-pair))
maybe-add: ((4 integer-boolean-pair))
cn1: (((1 integer)) <- ((copy)) ((34 literal)))
cn1: (((2 boolean)) <- ((copy)) ((nil literal)))
cn1: (((test1)) ((1 integer-boolean-pair)))
cn1: (((4 integer-boolean-pair)) <- ((next-input)))
schedule: main
run: main 0: (((1 integer)) <- ((copy)) ((34 literal)))
run: main 0: 34 => ((1 integer))
mem: ((1 integer)): 1 <= 34
run: main 1: (((2 boolean)) <- ((copy)) ((nil literal)))
run: main 1: nil => ((2 boolean))
mem: ((2 boolean)): 2 <= nil
run: main 2: (((test1)) ((1 integer-boolean-pair)))
mem: ((1 integer-boolean-pair)) => #(tagged record (34 nil . nil))
run: test1/main 0: (((4 integer-boolean-pair)) <- ((next-input)))
arg: nil 0 (#(tagged record (34 nil . nil)))
run: test1/main 0: #(tagged record (34 nil . nil)) => ((4 integer-boolean-pair))
mem: ((4 integer-boolean-pair)): 4 <= 34
mem: ((4 integer-boolean-pair)): 5 <= nil
schedule: done with routine nil

53
arc/.traces/arg-record-indirect

@ -1,53 +0,0 @@
c{0: 0 (((1 integer)) <- ((copy)) ((34 literal))) -- nil
c{0: 1 (((2 boolean)) <- ((copy)) ((nil literal))) -- nil
c{0: 2 (((3 integer-boolean-pair-address)) <- ((copy)) ((1 literal))) -- nil
c{0: 3 (((test1)) ((3 integer-boolean-pair-address) (deref))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((34 literal)))
c{1: 1 ✓ (((2 boolean)) <- ((copy)) ((nil literal)))
c{1: 2 ✓ (((3 integer-boolean-pair-address)) <- ((copy)) ((1 literal)))
c{1: 3 ✓ (((test1)) ((3 integer-boolean-pair-address) (deref)))
c{0: 0 (((4 integer-boolean-pair)) <- ((next-input))) -- nil
c{1: 0 ✓ (((4 integer-boolean-pair)) <- ((next-input)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((copy)) ((34 literal))) nil nil
cn0: checking arg ((34 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 boolean)) <- ((copy)) ((nil literal))) nil nil
cn0: checking arg ((nil literal))
cn0: checking oarg ((2 boolean))
maybe-add: ((2 boolean))
cn0: (((3 integer-boolean-pair-address)) <- ((copy)) ((1 literal))) nil nil
cn0: checking arg ((1 literal))
cn0: checking oarg ((3 integer-boolean-pair-address))
maybe-add: ((3 integer-boolean-pair-address))
cn0: (((test1)) ((3 integer-boolean-pair-address) (deref))) nil nil
cn0: checking arg ((3 integer-boolean-pair-address) (deref))
maybe-add: ((3 integer-boolean-pair-address) (deref))
cn0: convert-names in test1
cn0: (((4 integer-boolean-pair)) <- ((next-input))) nil nil
cn0: checking oarg ((4 integer-boolean-pair))
maybe-add: ((4 integer-boolean-pair))
cn1: (((1 integer)) <- ((copy)) ((34 literal)))
cn1: (((2 boolean)) <- ((copy)) ((nil literal)))
cn1: (((3 integer-boolean-pair-address)) <- ((copy)) ((1 literal)))
cn1: (((test1)) ((3 integer-boolean-pair-address) (deref)))
cn1: (((4 integer-boolean-pair)) <- ((next-input)))
schedule: main
run: main 0: (((1 integer)) <- ((copy)) ((34 literal)))
run: main 0: 34 => ((1 integer))
mem: ((1 integer)): 1 <= 34
run: main 1: (((2 boolean)) <- ((copy)) ((nil literal)))
run: main 1: nil => ((2 boolean))
mem: ((2 boolean)): 2 <= nil
run: main 2: (((3 integer-boolean-pair-address)) <- ((copy)) ((1 literal)))
run: main 2: 1 => ((3 integer-boolean-pair-address))
mem: ((3 integer-boolean-pair-address)): 3 <= 1
run: main 3: (((test1)) ((3 integer-boolean-pair-address) (deref)))
mem: ((3 integer-boolean-pair-address) (deref)) => #(tagged record (34 nil . nil))
run: test1/main 0: (((4 integer-boolean-pair)) <- ((next-input)))
arg: nil 0 (#(tagged record (34 nil . nil)))
run: test1/main 0: #(tagged record (34 nil . nil)) => ((4 integer-boolean-pair))
mem: ((4 integer-boolean-pair)): 4 <= 34
mem: ((4 integer-boolean-pair)): 5 <= nil
schedule: done with routine nil

46
arc/.traces/array-bounds-check

@ -1,46 +0,0 @@
c{0: 0 (((1 integer)) <- ((copy)) ((2 literal))) -- nil
c{0: 1 (((2 integer)) <- ((copy)) ((23 literal))) -- nil
c{0: 2 (((3 integer)) <- ((copy)) ((24 literal))) -- nil
c{0: 3 (((4 integer)) <- ((index)) ((1 integer-array)) ((2 literal))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((2 literal)))
c{1: 1 ✓ (((2 integer)) <- ((copy)) ((23 literal)))
c{1: 2 ✓ (((3 integer)) <- ((copy)) ((24 literal)))
c{1: 3 ✓ (((4 integer)) <- ((index)) ((1 integer-array)) ((2 literal)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((copy)) ((2 literal))) nil nil
cn0: checking arg ((2 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 integer)) <- ((copy)) ((23 literal))) nil nil
cn0: checking arg ((23 literal))
cn0: checking oarg ((2 integer))
maybe-add: ((2 integer))
cn0: (((3 integer)) <- ((copy)) ((24 literal))) nil nil
cn0: checking arg ((24 literal))
cn0: checking oarg ((3 integer))
maybe-add: ((3 integer))
cn0: (((4 integer)) <- ((index)) ((1 integer-array)) ((2 literal))) nil nil
cn0: checking arg ((1 integer-array))
maybe-add: ((1 integer-array))
cn0: checking arg ((2 literal))
cn0: checking oarg ((4 integer))
maybe-add: ((4 integer))
cn1: (((1 integer)) <- ((copy)) ((2 literal)))
cn1: (((2 integer)) <- ((copy)) ((23 literal)))
cn1: (((3 integer)) <- ((copy)) ((24 literal)))
cn1: (((4 integer)) <- ((index)) ((1 integer-array)) ((2 literal)))
schedule: main
run: main 0: (((1 integer)) <- ((copy)) ((2 literal)))
run: main 0: 2 => ((1 integer))
mem: ((1 integer)): 1 <= 2
run: main 1: (((2 integer)) <- ((copy)) ((23 literal)))
run: main 1: 23 => ((2 integer))
mem: ((2 integer)): 2 <= 23
run: main 2: (((3 integer)) <- ((copy)) ((24 literal)))
run: main 2: 24 => ((3 integer))
mem: ((3 integer)): 3 <= 24
run: main 3: (((4 integer)) <- ((index)) ((1 integer-array)) ((2 literal)))
array-len: ((1 integer-array))
mem: ((1 integer)) => 2
-: die: 2 is out of bounds of array 1integer-array
schedule: done with dead routine main

100
arc/.traces/array-copy-indirect-scoped

@ -1,100 +0,0 @@
c{0: 0 (((10 integer)) <- ((copy)) ((30 literal))) -- nil
c{0: 1 (((default-space space-address)) <- ((copy)) ((10 literal))) -- nil
c{0: 2 (((1 integer)) <- ((copy)) ((2 literal))) -- nil
c{0: 3 (((2 integer)) <- ((copy)) ((23 literal))) -- nil
c{0: 4 (((3 boolean)) <- ((copy)) ((nil literal))) -- nil
c{0: 5 (((4 integer)) <- ((copy)) ((24 literal))) -- nil
c{0: 6 (((5 boolean)) <- ((copy)) ((t literal))) -- nil
c{0: 7 (((6 integer-boolean-pair-array-address)) <- ((copy)) ((12 literal))) -- nil
c{0: 8 (((7 integer-boolean-pair-array)) <- ((copy)) ((6 integer-boolean-pair-array-address) (deref))) -- nil
c{1: 0 ✓ (((10 integer)) <- ((copy)) ((30 literal)))
c{1: 1 ✓ (((default-space space-address)) <- ((copy)) ((10 literal)))
c{1: 2 ✓ (((1 integer)) <- ((copy)) ((2 literal)))
c{1: 3 ✓ (((2 integer)) <- ((copy)) ((23 literal)))
c{1: 4 ✓ (((3 boolean)) <- ((copy)) ((nil literal)))
c{1: 5 ✓ (((4 integer)) <- ((copy)) ((24 literal)))
c{1: 6 ✓ (((5 boolean)) <- ((copy)) ((t literal)))
c{1: 7 ✓ (((6 integer-boolean-pair-array-address)) <- ((copy)) ((12 literal)))
c{1: 8 ✓ (((7 integer-boolean-pair-array)) <- ((copy)) ((6 integer-boolean-pair-array-address) (deref)))
cn0: convert-names in main
cn0: (((10 integer)) <- ((copy)) ((30 literal))) nil nil
cn0: checking arg ((30 literal))
cn0: checking oarg ((10 integer))
maybe-add: ((10 integer))
cn0: (((default-space space-address)) <- ((copy)) ((10 literal))) nil nil
cn0: checking arg ((10 literal))
cn0: checking oarg ((default-space space-address))
maybe-add: ((default-space space-address))
cn0: (((1 integer)) <- ((copy)) ((2 literal))) nil nil
cn0: checking arg ((2 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 integer)) <- ((copy)) ((23 literal))) nil nil
cn0: checking arg ((23 literal))
cn0: checking oarg ((2 integer))
maybe-add: ((2 integer))
cn0: (((3 boolean)) <- ((copy)) ((nil literal))) nil nil
cn0: checking arg ((nil literal))
cn0: checking oarg ((3 boolean))
maybe-add: ((3 boolean))
cn0: (((4 integer)) <- ((copy)) ((24 literal))) nil nil
cn0: checking arg ((24 literal))
cn0: checking oarg ((4 integer))
maybe-add: ((4 integer))
cn0: (((5 boolean)) <- ((copy)) ((t literal))) nil nil
cn0: checking arg ((t literal))
cn0: checking oarg ((5 boolean))
maybe-add: ((5 boolean))
cn0: (((6 integer-boolean-pair-array-address)) <- ((copy)) ((12 literal))) nil nil
cn0: checking arg ((12 literal))
cn0: checking oarg ((6 integer-boolean-pair-array-address))
maybe-add: ((6 integer-boolean-pair-array-address))
cn0: (((7 integer-boolean-pair-array)) <- ((copy)) ((6 integer-boolean-pair-array-address) (deref))) nil nil
cn0: checking arg ((6 integer-boolean-pair-array-address) (deref))
maybe-add: ((6 integer-boolean-pair-array-address) (deref))
cn0: checking oarg ((7 integer-boolean-pair-array))
maybe-add: ((7 integer-boolean-pair-array))
cn1: (((10 integer)) <- ((copy)) ((30 literal)))
cn1: (((default-space space-address)) <- ((copy)) ((10 literal)))
cn1: (((1 integer)) <- ((copy)) ((2 literal)))
cn1: (((2 integer)) <- ((copy)) ((23 literal)))
cn1: (((3 boolean)) <- ((copy)) ((nil literal)))
cn1: (((4 integer)) <- ((copy)) ((24 literal)))
cn1: (((5 boolean)) <- ((copy)) ((t literal)))
cn1: (((6 integer-boolean-pair-array-address)) <- ((copy)) ((12 literal)))
cn1: (((7 integer-boolean-pair-array)) <- ((copy)) ((6 integer-boolean-pair-array-address) (deref)))
schedule: main
run: main 0: (((10 integer)) <- ((copy)) ((30 literal)))
run: main 0: 30 => ((10 integer))
mem: ((10 integer)): 10 <= 30
run: main 1: (((default-space space-address)) <- ((copy)) ((10 literal)))
run: main 1: 10 => ((default-space space-address))
run: main 2: (((1 integer)) <- ((copy)) ((2 literal)))
run: main 2: 2 => ((1 integer))
mem: ((1 integer)): 12 <= 2
run: main 3: (((2 integer)) <- ((copy)) ((23 literal)))
run: main 3: 23 => ((2 integer))
mem: ((2 integer)): 13 <= 23
run: main 4: (((3 boolean)) <- ((copy)) ((nil literal)))
run: main 4: nil => ((3 boolean))
mem: ((3 boolean)): 14 <= nil
run: main 5: (((4 integer)) <- ((copy)) ((24 literal)))
run: main 5: 24 => ((4 integer))
mem: ((4 integer)): 15 <= 24
run: main 6: (((5 boolean)) <- ((copy)) ((t literal)))
run: main 6: t => ((5 boolean))
mem: ((5 boolean)): 16 <= t
run: main 7: (((6 integer-boolean-pair-array-address)) <- ((copy)) ((12 literal)))
run: main 7: 12 => ((6 integer-boolean-pair-array-address))
mem: ((6 integer-boolean-pair-array-address)): 17 <= 12
run: main 8: (((7 integer-boolean-pair-array)) <- ((copy)) ((6 integer-boolean-pair-array-address) (deref)))
array-len: ((12 integer-boolean-pair-array) (raw))
mem: ((12 integer) (raw)) => 2
mem: ((6 integer-boolean-pair-array-address) (deref)) => #(tagged record (2 23 nil 24 t . nil))
run: main 8: #(tagged record (2 23 nil 24 t . nil)) => ((7 integer-boolean-pair-array))
mem: ((7 integer-boolean-pair-array)): 18 <= 2
mem: ((7 integer-boolean-pair-array)): 19 <= 23
mem: ((7 integer-boolean-pair-array)): 20 <= nil
mem: ((7 integer-boolean-pair-array)): 21 <= 24
mem: ((7 integer-boolean-pair-array)): 22 <= t
schedule: done with routine nil

0
arc/.traces/before

0
arc/.traces/before-after

10
arc/.traces/before-after-any-order

@ -1,10 +0,0 @@
c{0: 0 label1 -- ((open 0))
c{0: 1 (((1 integer)) <- ((copy)) ((0 literal))) -- ((open 0))
c{1: 1 ✓ (((1 integer)) <- ((copy)) ((0 literal)))
cn0: convert-names in f1
cn0: (((1 integer)) <- ((copy)) ((0 literal))) nil nil
cn0: checking arg ((0 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn1: label1
cn1: (((1 integer)) <- ((copy)) ((0 literal)))

10
arc/.traces/before-after-braces

@ -1,10 +0,0 @@
c{0: 0 label1 -- ((open 0))
c{0: 1 (((1 integer)) <- ((copy)) ((0 literal))) -- ((open 0))
c{1: 1 ✓ (((1 integer)) <- ((copy)) ((0 literal)))
cn0: convert-names in f1
cn0: (((1 integer)) <- ((copy)) ((0 literal))) nil nil
cn0: checking arg ((0 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn1: label1
cn1: (((1 integer)) <- ((copy)) ((0 literal)))

0
arc/.traces/before-after-independent

0
arc/.traces/before-after-multiple

0
arc/.traces/before-multiple

0
arc/.traces/before-scoped

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save