70-rename-plan.md 2.2 KB

Rename work plan (procN/globalN -> meaningful names)

Do in dependency order; verify by recompiling to 100% MCode match (the repo's existing check: decompiled sources must reproduce the .MCD).

Phase 1 — Compiler + Scanner (types known)

  1. Compiler.Record/RecordPtr/ArrayPtr: document word0..word5/high once; all later renames refer to it.
  2. Compiler PROC3..18, PROC1, GETINP, PROC10..13 per 20-compiler-module.md. Mechanical: global31->curScope, global32/33->saveScope/baseScope, global35->lastParamList, global20/21->systemMod/storageMod.
  3. Scanner globals + GetSym/Accept/Expect/Test/NextChar/Refill per 30-scanner-module.md. Keep Z80 helpers (Allocate/FindIdent/ StrCmp/StrLen) byte-identical (padding comments are load-bearing).
  4. Rebuild + unassemble.c diff against compiler.txt/scanner.txt.

Phase 2 — CodeGen (no parser dependency)

  1. Rename buffer/fixup state + Emit*/Peek/Poke/Flush/OpenFix/CloseFix per 50-codegen.md. Opcodes already named; do not renumber.
  2. Diff against codegen.txt.

Phase 3 — SymTab + Errors (needs 1+2)

  1. Reconstruct SYMTAB.MOD header from SYMTAB.DEF + symtab.txt proc boundaries; rename moduleTab/curScope/symTop/... per 40-symtab-errors.md.
  2. Rename Errors procs per same file; keep DoError stack/heap MOVE arithmetic exact (CBACKUP.$$$, FREEMARKER, 030CH/0316H).
  3. Diff against symtab.txt/errors.txt.

Phase 4 — Express -> Statemen -> Pass1 (needs 1-3)

  1. Express: EXPRES/ParseSimpleExpr/FoldConstOp/MatchOpClass/Designator* first; they are called by the other two.
  2. Statemen: STMT/STATSE/ParseStatSeq/CASE/FOR next.
  3. Pass1: GetIdent/ParseType/ParseRecord/DCL/DCLS/PROCDE/MAINDE/WriteSym last.
  4. Keep COMPILE link order Pass1+Statemen+Express; GENZ80 untouched until MCode output is stable.

Conventions

  • ~ prefix in docs = inferred, not yet confirmed by recompile.
  • One module per commit; keep tr -d '\032\r' normalisation out of diffs (convert once, or keep CRLF — decide once, stay consistent).
  • Each rename commit must state: files touched, old->new table, unassemble match result (yes/no + differing offsets).