Skip to content

The ledger: every feature, its step off eudplib, and what a map of our own makes of it - #41

Merged
jeany55 merged 6 commits into
trigscript-4from
ledger
Oct 20, 2026
Merged

jeany55 merged 6 commits into
trigscript-4from
ledger

Conversation

@jeany55

@jeany55 jeany55 commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

The ledger the audit (#40) asked for, built before step 4: one script per feature of TrigScript, each saying which step of the way off eudplib makes it work in a map of our own, and whether a map of our own takes it today. It turned up three bugs that both builds had, now fixed.

The ledger. ledger/<area>/ holds 831 scripts. Each one's first line is // ledger: step 4, refused: a product of two values or // ledger: step 1, takes.

  • tests/ledger.test.ts compiles each script as the editor does and asks emitOwn, the checks build-own makes, now shared. It fails when a first line no longer says what happens.
  • It also fails when something is in no script: a kind of the IR (129, less six the front end always takes out), a name a script has from the library, a member of on, ui, memory, local, a unit, a set of units or a task, or an export of a standard-library module (340 names).
  • npx tsx scripts/ledger.mts:
    • with no option, prints the table by step;
    • --write rewrites the first lines after a step lands, so the diff is the step's account;
    • --check <files> checks a few and shows the IR kinds they compiled to;
    • --missing lists what nothing reaches.
Step Taken
0 The start 157 of 158
1 Calls and recursion 33 of 33
2 Texts with numbers 6 of 6
3 Arrays of a fixed length 53 of 54
4 Numbers 0 of 59
5 The game's conditions and actions 0 of 193
6 The game's memory 0 of 49
7 Programs, owners and players 1 of 22
8 Texts as values 0 of 43
9 Arrays that grow, the heap 0 of 27
10 Units 0 of 99
11 Tasks, async and errors 0 of 44
12 Input 0 of 31
13 The map's own triggers 0 of 13

Two steps counted as done each still have one gap: a ?: of two booleans (step 0), and a cell read at a shifted index, xs[a >> 1] (step 3). Every script a map of our own takes was also run from its laid-out bytes against the simulator, with about forty edge cases besides. All printed the same.

Refusals say what they refuse. Most read "a assign it does not lower (no reason given)", which is how the missing arithmetic stayed hidden. Now unlowered names the first part of the statement the emitter never takes, with its line: "a product of two values, line 51", "the action Set Resources", "a write of unit.sight", "a unit's hp", "an event handled (on.killed)", "an error thrown or caught (try, throw)". Each refused statement keeps its own reason. A print to the owner named by its slot is now taken. A program owned by P9–P12 is now refused, since the game runs triggers for P1–P8 only (still to confirm in the game). The maps build-own makes of the five own probes are byte for byte as before.

Fixed, in both builds:

  • A field read straight off a pick was worked out when the script was built, as undefined. print(`${first(…)?.hp}`) printed "undefined", and if (first(…)?.cloaked) compiled to nothing. It is now read in the game, as u.hp is.
  • The action order(…) did not compile inside a program. on.order's name was taken for it.
  • music.loop(song) never compiled, not even the module's own example.

Each has a test that fails without its fix.

Open, recorded in the plan's new section "The ledger":

  • A function written outside the program that keeps a state, called inside it, is worked out once when the script is built: a counter prints 1, 1, 1. Its script is kept out of the ledger until it is refused or right.
  • order(…, orders.Move) makes an Order action with modifier 6.
  • disabled() and preserve() inside a program pass without a word.
  • Some false compile errors.
  • What a program lacks next to JavaScript.
  • The README's language reference predates TrigScript 4; the ledger is the list to write it again from at 4.0.

The suite: 1239 pass, the ledger included (the whole run 222 s against 215).

🤖 Generated with Claude Code

https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg

jeany55 and others added 6 commits October 19, 2026 23:23
…es, and its line

Most refusals read "a assign it does not lower (no reason given)": the checks' reasons were dropped or kept from an
earlier statement, so `a * b`, `a / 4`, `random(6)` and `minerals(P1)` were refused in the same words. Now each
statement refused keeps its own reason, and `unlowered` names the first part of it the emitter never takes, in a
script's words — "a product of two values, line 51", "the action Set Resources", "a write of unit.sight", "a unit's
hp", "an event handled (on.killed)", "an error thrown or caught (try, throw)" — preferring such a part over a reason of
how things are put together.

build-own's checks move into emitOwn (compiler/backend/own.ts), which the ledger asks too. A print to the owner by its
slot is taken; a program owned by P9 to P12, whose triggers the game does not run, is refused. The maps build-own makes
of the five own probes are byte for byte as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
…e script is built

`print(`${first({ owner: P1 })?.hp}`)` printed "undefined", `if (first(…)?.cloaked)` compiled to nothing, and
`n = first(…)?.hp ?? 5` to `n = 5`: the evaluator worked the field out of the pick object itself. A field of a pick is
read while the game runs now, as one of `local.selected` already was. Both builds had it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
…order

GAME_CALLS took every on.* event's name, so the library's own action `order(…)` was never worked out when the script
was built, and a program using it failed with "A call's arguments must be known". An event's name is the game's only
as `on.order(…)` or a unit's `u.order(…)`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
…op's own

`while (true) await play(s)` showed the loop no sleep of its own, so `start(music.loop(song))`, the module's own
example, never compiled. The loop plays the song itself and waits at least a frame at the end of each turn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
… a map of our own makes of it

831 scripts in ledger/<area>/, each a feature of the language or the library, its first line the step of the way off
eudplib that makes it a map of our own's and whether one takes it today, in the words of its refusal. 250 are taken:
steps 1-3 whole, the start but for a ?: of booleans, fixed arrays but for a cell read at a shifted index.

tests/ledger.test.ts holds every script to its first line, and holds the ledger to the language: every kind of the IR
(but the six the front end takes out), every name a script has from the library, the members of on, ui, memory, local,
a unit, a set of units and a task, and every export of the standard library's modules is in some script.
scripts/ledger.mts prints the table by step, writes the first lines anew after a step (--write), and checks a few or
lists what nothing reaches (--check, --missing).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
Its table by step; what was fixed with it (a field read off a pick, order() in a program, music.loop, a print to the
owner by slot, owners P9-P12); what is open (a function of the script that keeps a state, called in a program, worked
out once; orders.* in order(); disabled() and preserve() in a program said nothing; false errors; JavaScript a program
lacks); and the README's language reference, older than TrigScript 4, to be written again from the ledger at 4.0.
Refusals now name what they refuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T1CM9pLuTuAn3mgTEkjgVg
@jeany55
jeany55 merged commit 43b68a3 into trigscript-4 Oct 20, 2026
1 check passed
@jeany55
jeany55 deleted the ledger branch October 20, 2026 05:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant