← board

Experiment: compile FPC's own source as a pxx stress probe

Context — the milestone that raised the question

2026-07-05: pxx compiles real, unmodified FPC 3.2.2 fgl.pp under --mimic-fpc and the result runs correctlyTFPGList<Integer> (Add/IndexOf/Insert/Delete/Sort-with-callback/for-in enumerator) and TFPGMap<Integer,Integer>. That is a genuine maturity signal for the compiler front/backend: generics, method overloads, method pointers, properties, and a big real-world unit all work on someone else's Pascal.

But "compile fgl" ≠ "compile FPC". fgl is a library. It compiles because --mimic-fpc makes FPC source resolve uses types, sysutils, classes to pxx's RTL — pxx substitutes its own runtime, and fgl only needs container semantics, which pxx's RTL provides. Only units pxx does not ship (fgl, contnrs, …) come from the FPC tree.

The two paths, and why this is parked (not chased)

Path A — keep grinding fcl-base units (contnrs, custapp, inifiles, …). Every wall is a missing function/class in pxx's lib/rtl (TFPList, StdOut, GetEnvironmentVariableCount, …). Pure Track-B library accretion. fcl-base is dozens of units, each its own surface. This is an asymptote, not a finish line — you can add surface for weeks and never reach "compile FPC." Low intellectual signal: the hard compiler constructs are already proven. (If someone does want to knock a couple down: TFPList/TFPObjectList in lib/rtl/classes.pas unlocks contnrs and inifiles together.)

Path B — compile FPC's compiler (compiler/pp.pas, cutils, cclasses). Genuinely harder and more interesting — it stresses pxx differently. Probed 2026-07-05, first wall in ~5 minutes:

Why probe, not complete

The value of Path B is not finishing it — it is reading the first 3–4 walls to learn what kind of gap they are:

The fcl-base grind (Path A) surfaces only library gaps and teaches nothing new about the compiler. Path B is the informative experiment.

Concrete first steps when picked up

  1. Accept {$asmMode <anything>} (parse-and-ignore non-intel values) — one lexer/directive edit. Unblocks the very first token of every compiler unit.
  2. Stand up an FPC-compiler define profile (--mimic-fpc-compiler, or a defines file consumed like the per-library config) supplying x86_64 + the fpcdefs.inc gates. Reuse the synapse per-library-defines machinery.
  3. Point at cutils first (lowest-level, fewest deps), then cclasses. Record each wall and classify it capability-gap vs RTL-coupling.
  4. Stop after ~4 walls and decide: rabbit hole, or a real target worth a dedicated push.

Explicitly deferred / undecided

Acceptance (of the experiment, not of "FPC compiles")

A short write-up: the first 3–4 FPC-compiler-source walls, each classified capability-gap vs RTL-coupling, and a recommendation on whether Path B is worth a dedicated push. No code must ship for this ticket to be "done" — the deliverable is the signal.