summary_showcase21.md 2.9 KB

Session summary — 2026-10-01 (b): showcase21 — suffixes, coroutines, library

Suite 174/174; self-hosting fixpoint OK (image 2,785,569 bytes). master, tree clean except the user's uncommitted compiler/toto.mod.

This step tours the three features landed this session on items 2, 4 and 6 of the gaps list (1 GOTO, 3 generics, 5 multiple inheritance were deliberately skipped).

Steps, tags and headline commits

Step Tag Commit What
Language + library v3-resultsfx-coroutines-lib 31adfc3 suffixes, coroutines, core library
Notes — e844223 session summary
LongIO — b1a52db channel-based LONGREAL I/O
Showcase v3-showcase21 (this commit) showcase21 end to end

1. Result suffixes

F()^, F()[i], F().field — components applied to a function-call result (ResultComp in M2.atg, inside the call group so the Coco/R grammar stays LL(1)-clean). A final scalar is loaded with ElemLoad; aggregates stay as their descriptor address. Expression context only.

2. PIM coroutines

PROCESS plus NEWPROCESS/TRANSFER/IOTRANSFER are predefined in SYSTEM (with a new parameterless PROC type) and bind to ucontext-backed helpers in runtime/syslib/shim.c. Coroutine bodies are called with a 0 static link (module-level procedures).

3. Standard library

gm2/ISO names added under stdlib/: ConvTypes, IOConsts, SIOResult, TERMINATION, StrIO, InOut, StdIO, WholeStr, RealStr, LongStr, LongMath, LongIO, STextIO, SWholeIO, SRealIO, DynamicStrings (core) and SysStorage. Backend fixes alongside: procedure values / LONGINT are 8-byte in array load/store and the parameter prologue; driver session file cap 32 → 128; Math.ln/arctan wrap log/atan.

4. Showcase

compiler/tests/showcase21.mod (Showcase21, exit 42) exercises:

  • result suffixes — GetRec()^.a + GetRec()^.b = 42, GetArr()^[i] sums to 4, then 40 + 2 + 2 - 2 = 42;
  • coroutines — Ping/Pong ping-pong via TRANSFER, hand control back to the main process after five hits;
  • library — RealStr.RealToFixed(42.0, 0, num) gives "42", LongMath.sqrt(1764.0) round-trips to 42, and WholeStr.CardToStr

    • DynamicStrings build the label.

      showcase21 total=42
      

Tests (174, was 171)

New this session: t_resultsfx, t_coroutine, t_dynstr, library1 (16-module session) and Showcase21. Full suite green.

Resume

cd .../m2compiler-V3
./bootstrap/fixpoint.sh                       # FIXPOINT OK
cd compiler && ./build.sh && ./run_tests.sh   # 174/174

Remaining

GOTO/labels, generics, multiple inheritance (deliberate), full forward variables, statement-context result suffixes, and the channel/device library holes (LongWholeIO, wrapclock/wraptime/ wrapc, TimeString, ChanConsts/GenDevIF/DeviceTablePtr/ StdChans/StreamFile/FIO).