Przeglądaj źródła

docs: milestone summary — V3 self-hosts (byte-identical fixpoint)

Eric Streit 1 tydzień temu
rodzic
commit
fedc50c0c7
1 zmienionych plików z 67 dodań i 0 usunięć
  1. 67 0
      docs/summary_selfhosting.md

+ 67 - 0
docs/summary_selfhosting.md

@@ -0,0 +1,67 @@
+# Milestone: V3 self-hosts (byte-identical fixpoint)
+
+Tags `v3-fixpoint`, `v3-bootstrap`, `v3-selfhosting`.
+Suite **111/111**.
+
+## What it means
+
+`m2compiler-V3` now compiles its **own complete source set** with
+itself, reproducing its image **byte for byte**:
+
+```
+bootstrap/fixpoint.sh
+  Stage 1  gm2 -fiso builds V3 (CR -m)             -> m2s1
+  Stage 2  m2s1 compiles SymTab QbeGen M2S M2P M2  -> stage2.ssa  -> m2s2
+  Stage 3  m2s2 compiles the same set              -> stage3.ssa
+  cmp                                               -> FIXPOINT OK
+                                                       (1,991,439 bytes)
+```
+
+The compiler no longer needs GNU Modula-2 except as a one-time seed for
+Stage 1; Stage 2 onward is V3 all the way down.
+
+## The pipeline
+
+- **Frontend**: Coco/R grammar (`src/M2.atg` → `M2S` scanner, `M2P`
+  parser, `M2` driver).
+- **Symbol table** (`SymTab`) + **QBE backend** (`QbeGen`) → SSA text.
+- **`qbe` → `cc`** (with `runtime/syslib/shim.c`).
+- Two compiler generations coexist: gm2 builds it for the seed; V3
+  rebuilds it thereafter.
+
+## Building blocks delivered along the way
+
+Language: scalars, composites (arrays/records/sets/pointers), control
+flow, procedures (value/VAR/open/nested + static links/FORWARD),
+separate compilation (DEFINITION/IMPLEMENTATION, IMPORT, opaque),
+64-bit ints, `ADDRESS`/`ADR`/`SIZE`, procedure types + indirect calls,
+Wirth-style nested modules, short-circuit `AND`/`OR`, `BITSET`, typed
+set constructors, `HALT`, and GNU-compatible literals (`0x`, octal
+char, `LENGTH`/`ORDL`/`CAP`, `&`/`~`).
+
+Runtime/ABI: NUL-terminated CHAR arrays (terminator slot at index =
+count), inline record array fields, heap/stack descriptor initialisation
+(nested arrays included), string lib (`Strings`), `FileIO` (host for
+Stage 1; self-hosted `runtime/syslib/FileIO` for Stage 2+), C shim.
+
+## Reproduce
+
+```sh
+cd /home/eric/Projets/Projets-Modula2/MyWork/m2compiler-V3
+./bootstrap/fixpoint.sh                        # FIXPOINT OK
+cd compiler && ./build.sh && ./run_tests.sh    # 111/111
+```
+
+## Deliberate divergences (per plan)
+
+No generics/interfaces, no ARC/exceptions, QBE backend is terminal (no
+native codegen), Linux only, and some GNU/classic conveniences accepted
+for self-hosting. `SYSTEM` facilities are built-ins, not an importable
+module.
+
+## Where to go next
+
+- Make cross-stage `FileIO` selection explicit; `M2make`-driven builds.
+- Broaden the stdlib; the Unicode step from `docs/plan.md` (UCHAR/
+  UString).
+- Optional native backend / additional targets (Blaise parity).