← board

Eof (standard input) not recognized

Problem

examples/chess/chess.pas:895 uses bare Eof to test standard input:

while running do
begin
  write('chess> ');
  if Eof then Break;     { pascal26:895: error: undefined variable (Eof) }
  readln(line);
  ...

PXX does not recognize Eof (no-arg, standard input). readln/writeln/read are compiler keyword-builtins (tkReadln, …); Eof has no such token and no RTL symbol, so it resolves to nothing.

Direction

Acceptance

Resolution (2026-06-21, Track A)

Implemented as a no-arg special builtin (call id 210, like Length), x86-64 codegen — the same support level as readln (both x86-64-only; cross errors gracefully with "builtin/special call not yet supported", no crash).

LANDMINE (cost a debug cycle): the BSS-allocation edit that added BSS_PEEK_VALID/BYTE accidentally dropped the BSS_LINE_LEN line, so len aliased another global (nonzero) → pos<len always true → Eof skipped its read and readln segfaulted. Restored the allocation. When inserting BSS slots, do not disturb the existing ones.

Log