From d02aa9ac0b9e1130ffcd5a27aa1304e80eee08d9 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Thu, 2 Jan 2020 01:28:24 -0800 Subject: 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. --- 030---translate.cc | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) (limited to '030---translate.cc') 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"; } -- cgit 1.4.1-2-gfad0