Refusal-site tokens in the value rewriters and the unit dispatch of rpg_eval.zig #760

Manually merged
binjovi-bot merged 2 commits from lt2 into trunk 2026-11-08 12:05:01 +00:00
Owner

Refusal-site tokens in the value rewriters and the unit dispatch of rpg_eval.zig

The first oracle run showed that every control-flow refusal on an inlined
built-in ends at rpg_render_ctx.unhandledOperation s01, which does not say
which value rewriter declined. This change adds site tokens (the grammar and the
Debug-only gate of rpg_trace.zig are unchanged: refusal <file>.<function> sNN,
code locations only, no program content, no output change) to:

  • the rewriters: every return null / return false in rpg_trim.zig
    (argumentUnit and the loop readers), rpg_char.zig, rpg_array_element.zig,
    rpg_value_units.zig, rpg_choice.zig and rpg_eval_builtins.zig (the
    built-in expansion readers: %CHAR of an integer, the %SUBST / %REPLACE / %LEFT /
    %RIGHT / %CHECK range checks, %LOOKUP, %SQRT, %SCAN);

  • rpg_eval.zig runValues, where each unit is tried, in the order the units run:
    s01 value_units, s02 CCSID, s03 UCS-2, s04 trim, s05 frames,
    s06 programs, s07 choice. A token means that the unit read nothing in this
    statement. Units that never match leave this token only, so the set of tokens
    still separates the families;

  • runValues again, where the rewritten values were tried and did not read, so
    the plain operations run instead: s08 a step had no rule, s09 the stack or
    the lines were left over;

  • rpg_eval.zig run: s01, a step returned false.

  • the recognizers that own a return-point store (a label pointer, kind 22) or a
    subroutine region, because rpg_eval.step s02 (the 33 address push of a
    non-data symbol) is the fallback label that fires when one of them refused
    first: rpg_subroutines.zig (validRegion and the routine reader),
    rpg_display.zig and rpg_display_numeric.zig (the DSPLY proof),
    rpg_cycle.zig, rpg_cycle_effect.zig, rpg_cycle_end.zig,
    rpg_cycle_template.zig, rpg_cycle_transfer.zig (the cycle-start and
    linear-main init readers), rpg_static_init.zig and rpg_init_layout.zig
    (the module-init readers), and every other unit that matches kind 22:
    rpg_cases.zig, rpg_closing.zig, rpg_end.zig, rpg_until.zig,
    rpg_numeric.zig, rpg_loops.zig, rpg_file_ops.zig, rpg_specs.zig,
    rpg_io_routines.zig.

A token in a rewriter (rpg_trim.sourceOf s09) answers "which reader of that
unit declined"; the runValues tokens answer "which units read nothing at all".
A reader that scans every position (rpg_array_element.decimalPrefix,
rpg_value_units.shape) also fires on each position it does not match, so a
count of those tokens is a count of probes, not of refused statements.

rpg_trace_test.zig lists the six new files and holds each new token to the
same pattern, uniqueness and file-name checks. rpg_eval.zig step is unchanged;
rpg_statements.zig is unchanged.

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"regenerated","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":493,"new":493},"twins":{"groups":748,"recovered":730,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":986}}
# Refusal-site tokens in the value rewriters and the unit dispatch of rpg_eval.zig The first oracle run showed that every control-flow refusal on an inlined built-in ends at `rpg_render_ctx.unhandledOperation s01`, which does not say which value rewriter declined. This change adds site tokens (the grammar and the Debug-only gate of `rpg_trace.zig` are unchanged: `refusal <file>.<function> sNN`, code locations only, no program content, no output change) to: - the rewriters: every `return null` / `return false` in `rpg_trim.zig` (`argumentUnit` and the loop readers), `rpg_char.zig`, `rpg_array_element.zig`, `rpg_value_units.zig`, `rpg_choice.zig` and `rpg_eval_builtins.zig` (the built-in expansion readers: %CHAR of an integer, the %SUBST / %REPLACE / %LEFT / %RIGHT / %CHECK range checks, %LOOKUP, %SQRT, %SCAN); - `rpg_eval.zig runValues`, where each unit is tried, in the order the units run: `s01` value_units, `s02` CCSID, `s03` UCS-2, `s04` trim, `s05` frames, `s06` programs, `s07` choice. A token means that the unit read nothing in this statement. Units that never match leave this token only, so the set of tokens still separates the families; - `runValues` again, where the rewritten values were tried and did not read, so the plain operations run instead: `s08` a step had no rule, `s09` the stack or the lines were left over; - `rpg_eval.zig run`: `s01`, a step returned false. - the recognizers that own a return-point store (a label pointer, kind 22) or a subroutine region, because `rpg_eval.step s02` (the `33` address push of a non-data symbol) is the fallback label that fires when one of them refused first: `rpg_subroutines.zig` (`validRegion` and the routine reader), `rpg_display.zig` and `rpg_display_numeric.zig` (the DSPLY proof), `rpg_cycle.zig`, `rpg_cycle_effect.zig`, `rpg_cycle_end.zig`, `rpg_cycle_template.zig`, `rpg_cycle_transfer.zig` (the cycle-start and linear-main init readers), `rpg_static_init.zig` and `rpg_init_layout.zig` (the module-init readers), and every other unit that matches kind 22: `rpg_cases.zig`, `rpg_closing.zig`, `rpg_end.zig`, `rpg_until.zig`, `rpg_numeric.zig`, `rpg_loops.zig`, `rpg_file_ops.zig`, `rpg_specs.zig`, `rpg_io_routines.zig`. A token in a rewriter (`rpg_trim.sourceOf s09`) answers "which reader of that unit declined"; the `runValues` tokens answer "which units read nothing at all". A reader that scans every position (`rpg_array_element.decimalPrefix`, `rpg_value_units.shape`) also fires on each position it does not match, so a count of those tokens is a count of probes, not of refused statements. `rpg_trace_test.zig` lists the six new files and holds each new token to the same pattern, uniqueness and file-name checks. rpg_eval.zig `step` is unchanged; rpg_statements.zig is unchanged. ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden floor 173 ceiling 0 <= dump 173/5/0","legend":"regenerated","emit":{"worse":[],"better":0,"newly_clean":0,"clean_delta":0,"base":493,"new":493},"twins":{"groups":748,"recovered":730,"regressions":[],"newly":0},"allgroups":{"regressions":[],"newly":[],"worse":[]},"full_check":{"exit":0,"seconds":986}} ```
binjovi-bot manually merged commit 623d80aaf4 into trunk 2026-11-08 12:05:01 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
sean/sourcerer!760
No description provided.