SUMMARY.md 2.1 KB

Turbo Modula-2 compiler re-read — project summary

Upstream inputs (local only, git-ignored): Reversing-Turbo-Modula2-main/ (disasm + partial decompile) and Turbo-Modula-2-Reloaded-main/ (buildable system). Everything below is versioned: docs/compiler/ (analysis), src/compiler/ (renamed sources).

Problem

The compiler decompiled but was unreadable: every function/procedure/variable a bare number (procN/globalN/paramN/localN).

Done (tags)

  • compiler-outline-v1 — docs/compiler/00..70 + TAGGED-SUMMARY.md: folder analysis, per-module architecture, full rename plan.
  • compiler-renamed-v1 — src/compiler/COMPILER|SCANNER|ERRORS|CODEGEN.{DEF,MOD}, SYMTAB.DEF, README.md, RENAME-MAP.md: module-level identifiers renamed (e.g. InsertIdent/DeclConst/GetSym/NextChar/ReportError/FlushCodeWindow), cross-module qualified uses updated, 0x1A/0x00 padding stripped.
  • compiler-params-v1 — all paramN/localN in the 4 .MOD bodies renamed in-scope (kind/typeDesc/mark/sym/slot/bit/shown/desc/...); fixed a real shadowing bug (FindFileOnDrives: local currentDrive shadowing the global, now startDrive); fixed missed keywordHashFunc and modExtra field. Verified: no numbered identifiers remain in src/compiler/.
  • compiler-frontend-map-v1 — src/compiler/FRONTEND.md: every exported head of PASS1 (35), STATEMEN (19), EXPRESS (25+13 Z80 stubs) and SYMTAB bodies pinned (MCode offset + old name + proposed name + evidence), e.g. ~ParseType (02e6), ParseStatement (0566), ParseExpression (1221), Pass1Main (1027). No fake signatures — map only.

Deliberately pending

  • Pass1/Statemen/Express bodies (disassembly only, no upstream .MOD).
  • SYMTAB.MOD bodies (same).
  • GENZ80 native backend.
  • Recompile + unassemble.c diff verification of the renamed sources.

Next

Decompile in dependency order: SYMTAB (EnterIdent/LookupChain/ImportAll) → EXPRESS helpers → STMT/STATSE → CASE/FOR → Pass1 types → decls → module heads → SYM writer (docs/compiler/70-rename-plan.md, phase 4).