about summary refs log tree commit diff stats
path: root/030---translate.cc
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-01-02 01:28:24 -0800
committerKartik Agaram <vc@akkartik.com>2020-01-02 01:28:24 -0800
commitd02aa9ac0b9e1130ffcd5a27aa1304e80eee08d9 (patch)
treebf592fba4275002cbbde420cef8c806bb9b1b45f /030---translate.cc
parent01013f2ad2132dd945c6ceb168b85dc52e18882c (diff)
downloadmu-d02aa9ac0b9e1130ffcd5a27aa1304e80eee08d9.tar.gz
5863
Just clarified for myself why `subx translate` and `subx run` need to share
code: emulation supports the tests first and foremost.

In the process we clean up our architecture for levels of layers. It's
a good idea but unused once we reconceive of "level 1" as just part of
the test harness.
Diffstat (limited to '030---translate.cc')
-rw-r--r--030---translate.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/030---translate.cc b/030---translate.cc
index 9737834e..b950fce7 100644
--- a/030---translate.cc
+++ b/030---translate.cc
@@ -1,20 +1,9 @@
-//: The bedrock level 1 of abstraction is now done, and we're going to start
-//: building levels above it that make programming in x86 machine code a
-//: little more ergonomic.
-//:
-//: All levels will be "pass through by default". Whatever they don't
-//: understand they will silently pass through to lower levels.
-//:
-//: Since raw hex bytes of machine code are always possible to inject, SubX is
-//: not a language, and we aren't building a compiler. This is something
-//: deliberately leakier. Levels are more for improving auditing, checks and
-//: error messages rather than for hiding low-level details.
+//: After that lengthy prelude to define an x86 emulator, we are now ready to
+//: start translating SubX notation.
 
 //: Translator workflow: read 'source' file. Run a series of transforms on it,
 //: each passing through what it doesn't understand. The final program should
-//: be just machine code, suitable to write to an ELF binary.
-//:
-//: Higher levels usually transform code on the basis of metadata.
+//: be just machine code, suitable to emulate, or to write to an ELF binary.
 
 :(before "End Main")
 if (is_equal(argv[1], "translate")) {
@@ -69,6 +58,10 @@ if (is_equal(argv[1], "translate")) {
 }
 
 :(code)
+void transform(program& p) {
+  // End transform(program& p)
+}
+
 void print_translate_usage() {
   cerr << "Usage: subx translate file1 file2 ... -o output\n";
 }