|
|
@@ -13,8 +13,12 @@ phased process, self-hosting with byte-identical `.ssa` fixpoint.
|
|
|
`vendor/qbe-pin.txt`.
|
|
|
- Modern syntax base: PIM4/ISO core + Kowarsch/Redux cleanups —
|
|
|
`#` only (no `<>`), `NOT/AND/OR` only (no `~/&`), no `B/C` octal
|
|
|
- literals, `H` hex kept, unary minus takes a Factor. Evolved from
|
|
|
- V2 `M2comp.atg` (1290 lines), not pasted verbatim.
|
|
|
+ literals, `0x`-only hex, unary minus at expression start.
|
|
|
+ Evolved from V2 `M2comp.atg` (1290 lines), not pasted verbatim.
|
|
|
+ A second, fenced legacy grammar (`TopSpeed-V3-M2.atg`, step 1.12)
|
|
|
+ covers the historical dialect (`_`, `<>`, `H`/`C`/`B`) for corpus
|
|
|
+ ingestion — never merged into the modern grammar (see
|
|
|
+ `docs/blaise-phases-map.md`: our phase-10 sidecar).
|
|
|
- Test convention (from Test2): global `VAR ExitCode : INTEGER`
|
|
|
selects process exit code; otherwise return 0.
|
|
|
|
|
|
@@ -27,8 +31,9 @@ Blaise (`graemeg/blaise`) uses `compiler/`, `runtime/`, `stdlib/`,
|
|
|
```text
|
|
|
m2compiler-V3/
|
|
|
README.md build.sh run_tests.sh
|
|
|
- compiler/src/ M2.atg, compiler.frm, parser.frm, scanner.frm,
|
|
|
- FileIO, SymTab, AST, QbeGen, generated M2S/M2P/M2 (gitignored)
|
|
|
+ compiler/src/ M2.atg (+ TopSpeed-V3-M2.atg legacy sidecar),
|
|
|
+ frames, FileIO, SymTab, QbeGen, generated
|
|
|
+ scanner/parser/driver (gitignored)
|
|
|
compiler/tests/ accept / reject (.LST) / run (exit-code) tests
|
|
|
runtime/syslib/ SYSTEM, Storage, SysIO, SysClock, Trap, Utf8
|
|
|
always-linked, self-hostable, NO gm2-only imports
|
|
|
@@ -39,8 +44,8 @@ m2compiler-V3/
|
|
|
vendor/qbe-pin.txt
|
|
|
bootstrap/ stage1/ (gm2-built), stage2/, stage3/ (V3-built),
|
|
|
fixpoint.sh (rebuild 2x, diff -r *.ssa)
|
|
|
- docs/ plan.md (this file), spec.md, blaise-phases-map.md,
|
|
|
- summary_stepN.md
|
|
|
+ docs/ plan.md (this file), blaise-phases-map.md,
|
|
|
+ summary_stepN.md (one file per step)
|
|
|
```
|
|
|
|
|
|
Build outputs (`.o`, `.ssa`, `.s`, binaries) are never committed.
|
|
|
@@ -59,10 +64,10 @@ Build outputs (`.o`, `.ssa`, `.s`, binaries) are never committed.
|
|
|
|
|
|
| Step | Goal | Acceptance |
|
|
|
|------|------|------------|
|
|
|
-| 1 pipeline | minimal `M2.atg` + fresh `QbeGen` hello → `.ssa` → `qbe → cc → run` | 3 run tests |
|
|
|
-| 2 scalars | scalar type system, SymTab errors 200–224 + 230/232/233 (+234 unicode) | ~20 tests |
|
|
|
-| 3 composites | length-prefixed arrays/records/sets/pointers (§5) | layout tests green |
|
|
|
-| 4 modules/procs | DEFINITION/IMPLEMENTATION, opaque `TYPE T;`, nested/display, separate compilation | ADT tests (V2 goal_step8 scope) |
|
|
|
+| 1 pipeline | minimal `M2.atg` + fresh `QbeGen` hello → `.ssa` → `qbe → cc → run` | ✅ done (5/5 → grown since) |
|
|
|
+| 2 scalars | scalar type system, SymTab errors 200–224 + 230/232/233 (+234 unicode) | ✅ done (30/30: ints, bools, chars, REALs, control flow) |
|
|
|
+| 3 composites | length-prefixed arrays/records/sets/pointers (§5) | 🔄 3.1 arrays ✅, 3.2 showcase ✅, 3.3 sets ✅, 3.4 pointers next |
|
|
|
+| 4 modules/procs | DEFINITION/IMPLEMENTATION, opaque `TYPE T;`, nested/display, separate compilation | not started (syntax parses; lowering pending) |
|
|
|
| 5 stdlib | Strings/TextIO/WholeIO/Math/Files per Benjamin | I/O + file tests |
|
|
|
| 6 harden | CASE/WITH/LOOP/EXIT/FOR-BY, conversions, traps | full-suite green |
|
|
|
| 7 syslib port | rewrite FileIO on SysIO+Storage only; ban `Environment, FileSysOp, TextIO, RawIO, WholeIO, IOChan, SysClock, ProgramArgs` via `grep` gate | compiler sources syslib-clean; Stage1 still gm2-built |
|
|
|
@@ -113,16 +118,18 @@ self-hosting is the last phase. Hygiene from step 1: deterministic
|
|
|
- `TextIO.UWriteChar/UWriteString/UWriteLn`: encode to UTF-8, emit via
|
|
|
`SysIO` byte descriptors. Raw `WriteChar` stays byte-oriented.
|
|
|
|
|
|
-## 7. Interactive ATG order (next)
|
|
|
-
|
|
|
-1. `COMPILER M2` header + `CHARACTERS/IGNORE/COMMENTS/TOKENS`
|
|
|
- (incl. `ustring`, grown `LexString` buffer).
|
|
|
-2. Module / Definition / Implementation / Import (+ opaque hook).
|
|
|
-3. `CONST/TYPE/VAR/ProcHeading` + error codes (200–234).
|
|
|
-4. Types (scalars → UCHAR → composites → proc types).
|
|
|
-5. Statements (IF/CASE/WHILE/REPEAT/LOOP/EXIT/FOR/WITH/RETURN).
|
|
|
-6. Expressions (precedence, `IN`, set/pointer/UCHAR ops).
|
|
|
-7. Action wiring (`SymTab/AST/QbeGen` hooks) + `compiler.frm` driver.
|
|
|
+## 7. Interactive ATG order (done through §6; UCHAR/UString pending)
|
|
|
+
|
|
|
+1. `COMPILER M2` header + `CHARACTERS/IGNORE/COMMENTS/TOKENS` ✅
|
|
|
+ (`0x`, `E`-exponents, `//` decided interactively; `ustring`
|
|
|
+ token spelling locked, implementation pending with step 6).
|
|
|
+2. Module / Definition / Implementation / Import (+ opaque hook) ✅
|
|
|
+3. `CONST/TYPE/VAR/ProcHeading` + error codes (200–234) ✅
|
|
|
+4. Types (scalars ✅, UCHAR pending, composites 🔄 arrays+sets ✅,
|
|
|
+ records/pointers next, proc types with step 4).
|
|
|
+5. Statements ✅ (all but `WITH`, which rides with records).
|
|
|
+6. Expressions ✅ (relations, `IN`, set ops; pointer ops with 3.4).
|
|
|
+7. Action wiring ✅ (driver reports `file:line:col`).
|
|
|
|
|
|
Each section: proposed snippet → user approve/tweak → append to
|
|
|
`compiler/src/M2.atg` → `CR -m -C` syntax check before moving on.
|