diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-12-28 09:26:15 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-12-28 11:09:30 -0800 |
commit | dff67029adb1a27bff5937fa8e028fadbef521eb (patch) | |
tree | 2bdd43d9a812cc7b1a184f5c383a0e5a2038fc75 | |
parent | 7566d80ade1177939bf29345b5b5cbb976765cc5 (diff) | |
download | mu-dff67029adb1a27bff5937fa8e028fadbef521eb.tar.gz |
7439 - start translating Mu programs to baremetal
-rw-r--r-- | 100.txt | 2 | ||||
-rw-r--r-- | apps/README.md | 2 | ||||
-rwxr-xr-x | apps/survey_elf (renamed from apps/survey) | bin | 56701 -> 56701 bytes | |||
-rw-r--r-- | apps/survey_elf.subx (renamed from apps/survey.subx) | 10 | ||||
-rw-r--r-- | stats.txt | 6 | ||||
-rw-r--r-- | subx_bare.md | 6 | ||||
-rwxr-xr-x | test_apps | 4 | ||||
-rwxr-xr-x | test_apps_emulated | 4 | ||||
-rwxr-xr-x | translate_subx | 2 | ||||
-rwxr-xr-x | translate_subx_emulated | 2 |
10 files changed, 19 insertions, 19 deletions
diff --git a/100.txt b/100.txt index 076b9919..5d309194 100644 --- a/100.txt +++ b/100.txt @@ -4,7 +4,7 @@ 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.subx + apps/survey_elf.subx apps/pack.subx apps/dquotes.subx apps/assort.subx diff --git a/apps/README.md b/apps/README.md index 74b91c3a..665632c2 100644 --- a/apps/README.md +++ b/apps/README.md @@ -15,7 +15,7 @@ Some apps written in SubX and Mu. Check out: all the different syntax sugars and what they expand to. * Code unique to phases of our build toolchain: - * Core SubX: `hex`, `survey`, `pack`, `dquotes`, `assort`, `tests` + * Core SubX: `hex`, `survey_elf`, `pack`, `dquotes`, `assort`, `tests` * Syntax sugar for SubX: `sigils`, `calls`, `braces` * More ambitious translator for a memory-safe language (in progress): `mu` diff --git a/apps/survey b/apps/survey_elf index 67808f49..67808f49 100755 --- a/apps/survey +++ b/apps/survey_elf Binary files differdiff --git a/apps/survey.subx b/apps/survey_elf.subx index 80c5194e..65d610c7 100644 --- a/apps/survey.subx +++ b/apps/survey_elf.subx @@ -2,13 +2,13 @@ # (landscape). # Use the addresses assigned to: # a) replace labels -# b) add segment headers with addresses and offsets correctly filled in +# b) add an ELF header and segment headers with addresses and offsets correctly filled in # # To build: -# $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/survey.subx -o apps/survey +# $ ./bootstrap translate init.linux 0*.subx apps/subx-params.subx apps/survey_elf.subx -o apps/survey_elf # -# The expected input is a stream of bytes with segment headers, comments and -# some interspersed labels. +# The expected input is a stream of bytes with '==' segment headers, comments +# and some interspersed labels. # $ cat x # == code 0x1 # l1: @@ -23,7 +23,7 @@ # The output is the stream of bytes without segment headers or label definitions, # and with label references replaced with numeric values/displacements. # -# $ cat x |./bootstrap run apps/survey +# $ cat x |./bootstrap run apps/survey_elf # ...ELF header bytes... # # ELF header above will specify that code segment begins at this offset # aa bb nn # some computed address diff --git a/stats.txt b/stats.txt index b5736d84..4d229e3a 100644 --- a/stats.txt +++ b/stats.txt @@ -4,7 +4,7 @@ apps/factorial.subx 120 44 apps/crenshaw2-1.subx 561 180 apps/crenshaw2-1b.subx 757 186 apps/hex.subx 1442 149 -apps/survey.subx 4733 905 +apps/survey_elf.subx 4733 905 apps/pack.subx 5881 840 apps/dquotes.subx 1925 383 apps/assort.subx 905 183 @@ -20,7 +20,7 @@ apps/factorial.subx 8436 1700 apps/crenshaw2-1.subx 8644 1925 apps/crenshaw2-1b.subx 8736 1931 apps/hex.subx 9065 1908 -apps/survey.subx 10217 3248 +apps/survey_elf.subx 10217 3248 apps/pack.subx 10589 2727 apps/dquotes.subx 9262 2468 apps/assort.subx 8686 2425 @@ -36,7 +36,7 @@ apps/crenshaw2-1 41 4.3 apps/crenshaw2-1b 42 5.2 apps/factorial 42 5.2 apps/hex 45 5.0 -apps/survey 51 9.6 +apps/survey_elf 51 9.6 apps/pack 54 7.6 apps/dquotes 46 6.5 apps/assort 42 6.4 diff --git a/subx_bare.md b/subx_bare.md index f4ee07ff..535b14fd 100644 --- a/subx_bare.md +++ b/subx_bare.md @@ -133,15 +133,15 @@ translate itself. For example, running natively on Linux: ```sh # generate translator phases using the C++ translator $ ./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/survey_elf.subx -o survey_elf $ ./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 +$ chmod +x hex survey_elf pack assort dquotes tests # use the generated translator phases to translate SubX programs -$ cat init.linux apps/ex1.subx |./tests |./dquotes |./assort |./pack |./survey |./hex > a.elf +$ cat init.linux apps/ex1.subx |./tests |./dquotes |./assort |./pack |./survey_elf |./hex > a.elf $ chmod +x a.elf $ ./a.elf $ echo $? diff --git a/test_apps b/test_apps index 8f6253ba..dcaceb12 100755 --- a/test_apps +++ b/test_apps @@ -214,7 +214,7 @@ test "$1" = 'record' || git diff --exit-code apps/crenshaw2-1b # Phases of the self-hosted SubX translator. -for phase in hex survey pack assort dquotes tests +for phase in hex survey_elf pack assort dquotes tests do echo $phase ./bootstrap_bin translate init.linux [01]*.subx apps/subx-params.subx apps/$phase.subx -o apps/$phase @@ -307,7 +307,7 @@ done # Phases of the self-hosted SubX translator. -for app in hex survey pack assort dquotes tests +for app in hex survey_elf pack assort dquotes tests do echo $app ./translate_subx init.linux [01]*.subx apps/subx-params.subx apps/$app.subx diff --git a/test_apps_emulated b/test_apps_emulated index d70c8341..e0dd2848 100755 --- a/test_apps_emulated +++ b/test_apps_emulated @@ -152,7 +152,7 @@ test "$1" = 'record' || git diff --exit-code apps/crenshaw2-1b # Phases of the self-hosted SubX translator. -for phase in hex survey pack assort dquotes tests +for phase in hex survey_elf pack assort dquotes tests do echo $phase ./bootstrap_bin translate init.linux [01]*.subx apps/subx-params.subx apps/$phase.subx -o apps/$phase @@ -225,7 +225,7 @@ done # Phases of the self-hosted SubX translator. -for app in hex survey pack assort dquotes tests +for app in hex survey_elf pack assort dquotes tests do echo $app ./translate_subx_emulated init.linux [01]*.subx apps/subx-params.subx apps/$app.subx diff --git a/translate_subx b/translate_subx index ebde020a..bb8488fc 100755 --- a/translate_subx +++ b/translate_subx @@ -33,7 +33,7 @@ cat a.dquotes |apps/assort > a.assort2 cat a.assort2 |apps/pack > a.pack -cat a.pack |apps/survey > a.survey +cat a.pack |apps/survey_elf > a.survey cat a.survey |apps/hex > a.elf diff --git a/translate_subx_emulated b/translate_subx_emulated index 4a75c03b..730e020d 100755 --- a/translate_subx_emulated +++ b/translate_subx_emulated @@ -16,7 +16,7 @@ cat a.tests |./bootstrap_bin run apps/assort > a.assort cat a.assort |./bootstrap_bin run apps/dquotes > a.dquotes cat a.dquotes |./bootstrap_bin run apps/assort > a.assort2 cat a.assort2 |./bootstrap_bin run apps/pack > a.pack -cat a.pack |./bootstrap_bin run apps/survey > a.survey +cat a.pack |./bootstrap_bin run apps/survey_elf > a.survey cat a.survey |./bootstrap_bin run apps/hex > a.elf chmod +x a.elf |