Fixed-form calculations: CABxx, TAG and their C lines #671

Manually merged
binjovi-bot merged 1 commit from rpg-l7-fixed-calculations-20261029 into trunk 2026-10-29 13:47:04 +00:00
Owner

Fixed-form calculations: CABxx, TAG and their C lines

A program with CABxx and TAG (FLOW/return-fixed) has no free-form text: free
form has no branch to a label. The reader now proves both
(rpg_fixed_branch.zig): CABxx is the comparison of its factors, a jump on
true to a label whose code jumps to the TAG label, and the label after it
(CAB N > 50 L311); TAG is a statement with no code at a label that the
statement before defines and that an unconditional jump of the procedure
takes, where that jump is the TAG jump of a CABxx or the whole of its
statement (a GOTO): TAG L311. The ends of blocks have the same shape
(ON-ERROR and ENDMON of MONITOR/limits, the jumps of their MONITOR) and keep
their failure.

With either, the emitter writes the calculations as C lines in columns
(fixedMode), when the program has nothing that columns cannot write yet: no
control options, files, SQL, subprocedures or parameters. The mixed source of
gotos-static (free code with GOTO and TAG lines) has control options and
parameters: it stays free form, its TAG a failure line as before. Calibration H on the host (captures/calH-20261029): the source
with generated names matches its object, and so does it with EXSR, BEGSR and
ENDSR in free form; free arithmetic (N = N + 1: an add in 6 digits with an
overflow check inside an exception bracket, where ADD 1 N truncates to the
5 digits of N) and a free IF (if N > 3: the comparison inside a bracket,
where IFGT compares the opposite and jumps on true) compile to other
operations. So each C line is taken only from the operations of its fixed
form: Z-ADD (27 c; 61 p 0 0; 37 N), ADD, SUB and MULT (29; 27; 54/52/57 p s 0; 37 N, p the digits of the result field), IFxx (29; 27; compare; 17)
and CABxx; BEGSR, EXSR, ENDSR, ENDIF, RETURN and SETON LR as before. A
statement without a rule is a failure line, never free code. The first
assignment to a packed field without an initial value declares it in columns
64 to 70 (Z-ADD 1 N 5 0), so that no D line moves statement 1.

A decimal literal compared with a field with no rescale between them has the
decimal positions of the field: the compiler rescales one side before the
comparison when they differ (ftwin3-h7, I >= 12.25: 61 7 2 0 before
10). resolveMarks takes those comparisons as targets (N CABGT 50).

The emitted text of FLOW/return-fixed matched its object on the host
(calibration I, captures/calI-20261029).

Gates

{"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":80,"newly_clean":78,"clean_delta":78,"base":215,"new":293},"twins":{"groups":458,"recovered":450,"regressions":[],"newly":35},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-CONSTRUCT/POINTER/rpg-pointer-procedure-auto/stripped/archive.savf 1","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-edit/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/d4-editc-codes/stripped/object.savf 16","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7-args/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-auto/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 3","savf/SC-ILE/EXPERIMENTS/h-editc/stripped/object.savf 17","savf/SC-ILE/EXPERIMENTS/h-editc3/stripped/object.savf 24","savf/SC-ILE/EXPERIMENTS/h-editc5/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-editc6/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-fmix/stripped/object.savf 11","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/program-literal/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5b-onexit-for/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5c-cycle-files/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5e-date-field/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5e-editc-held/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5i-figurative/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5x-cycle-print/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6a-float-inz/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-blank/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-char/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-const/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-disk/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit1/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit2-int/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit2/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit3/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit4/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edita/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editj/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editword/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editz/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-end/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-disk-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ho-edit4-amt/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-editz-cnt/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-ind-const/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-nooflind-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ho-oflind60-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ind-fld/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ind-rec/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-nooflind/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-num/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-oflind50/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-skip/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-space/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-three-rec/stripped/object.savf 4","savf/SC-ILE/EXPERIMENTS/r6e-two-fld/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-two-rec/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/FLOW/return-fixed-observable/archive.savf 1","savf/SC-ILE/FLOW/return-fixed-stripped/archive.savf 1","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":772}}
# Fixed-form calculations: CABxx, TAG and their C lines A program with CABxx and TAG (FLOW/return-fixed) has no free-form text: free form has no branch to a label. The reader now proves both (`rpg_fixed_branch.zig`): CABxx is the comparison of its factors, a jump on true to a label whose code jumps to the TAG label, and the label after it (`CAB N > 50 L311`); TAG is a statement with no code at a label that the statement before defines and that an unconditional jump of the procedure takes, where that jump is the TAG jump of a CABxx or the whole of its statement (a GOTO): `TAG L311`. The ends of blocks have the same shape (ON-ERROR and ENDMON of MONITOR/limits, the jumps of their MONITOR) and keep their failure. With either, the emitter writes the calculations as C lines in columns (`fixedMode`), when the program has nothing that columns cannot write yet: no control options, files, SQL, subprocedures or parameters. The mixed source of gotos-static (free code with GOTO and TAG lines) has control options and parameters: it stays free form, its TAG a failure line as before. Calibration H on the host (captures/calH-20261029): the source with generated names matches its object, and so does it with EXSR, BEGSR and ENDSR in free form; free arithmetic (`N = N + 1`: an add in 6 digits with an overflow check inside an exception bracket, where `ADD 1 N` truncates to the 5 digits of N) and a free IF (`if N > 3`: the comparison inside a bracket, where IFGT compares the opposite and jumps on true) compile to other operations. So each C line is taken only from the operations of its fixed form: Z-ADD (`27 c; 61 p 0 0; 37 N`), ADD, SUB and MULT (`29; 27; 54/52/57 p s 0; 37 N`, p the digits of the result field), IFxx (`29; 27; compare; 17`) and CABxx; BEGSR, EXSR, ENDSR, ENDIF, RETURN and SETON LR as before. A statement without a rule is a failure line, never free code. The first assignment to a packed field without an initial value declares it in columns 64 to 70 (`Z-ADD 1 N 5 0`), so that no D line moves statement 1. A decimal literal compared with a field with no rescale between them has the decimal positions of the field: the compiler rescales one side before the comparison when they differ (ftwin3-h7, `I >= 12.25`: `61 7 2 0` before `10`). `resolveMarks` takes those comparisons as targets (`N CABGT 50`). The emitted text of FLOW/return-fixed matched its object on the host (calibration I, captures/calI-20261029). ## Gates ``` {"checks":{"net_statements":0},"census":{"statuses":{"recovered":645,"partial":0,"unresolved":0},"regressions":0,"newly_recovered":0},"golden":"golden 173/5/0 == dump 173/5/0","emit":{"worse":[],"better":80,"newly_clean":78,"clean_delta":78,"base":215,"new":293},"twins":{"groups":458,"recovered":450,"regressions":[],"newly":35},"allgroups":{"regressions":[],"newly":["rpg-corpus-captures/files-chain/stripped/object.savf 2","rpg-corpus-captures/files-display-write/stripped/object.savf 2","rpg-corpus-captures/files-logical/stripped/object.savf 2","savf/SC-CONSTRUCT/POINTER/rpg-pointer-procedure-auto/stripped/archive.savf 1","savf/SC-ILE/DSPLY/error-observable/archive.savf 2","savf/SC-ILE/DSPLY/error-stripped/archive.savf 2","savf/SC-ILE/DSPLY/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/d4-edit/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/d4-editc-codes/stripped/object.savf 16","savf/SC-ILE/EXPERIMENTS/d4-out-const/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-out-input/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/d4-srcstmt-dspf/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7-args/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/d7c-copy/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/decimal-fault-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/decimal-sign-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j1/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j2/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/fmtind-j3/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/format-base/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/format-rename/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/gotos-auto/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/gotos-static/stripped/archive.savf 3","savf/SC-ILE/EXPERIMENTS/h-editc/stripped/object.savf 17","savf/SC-ILE/EXPERIMENTS/h-editc3/stripped/object.savf 24","savf/SC-ILE/EXPERIMENTS/h-editc5/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-editc6/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/h-fmix/stripped/object.savf 11","savf/SC-ILE/EXPERIMENTS/h-subind/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/packed-add-report/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/packed-compose-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/packed-compose-sign-report/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/program-literal/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5b-onexit-for/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5c-cycle-files/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/r5e-date-field/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5e-editc-held/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5i-figurative/stripped/archive.savf 1","savf/SC-ILE/EXPERIMENTS/r5x-cycle-print/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6a-float-inz/stripped/object.savf 1","savf/SC-ILE/EXPERIMENTS/r6a-reset-ds/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-fixed/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6a-reset-two/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-blank/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-char/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-const/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-disk/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit1/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit2-int/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit2/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit3/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edit4/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-edita/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editj/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editword/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-editz/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-end/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-disk-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ho-edit4-amt/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-editz-cnt/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-ind-const/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ho-nooflind-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ho-oflind60-two/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/r6e-ind-fld/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-ind-rec/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-nooflind/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-num/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-oflind50/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-skip/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-space/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-three-rec/stripped/object.savf 4","savf/SC-ILE/EXPERIMENTS/r6e-two-fld/stripped/object.savf 2","savf/SC-ILE/EXPERIMENTS/r6e-two-rec/stripped/object.savf 3","savf/SC-ILE/EXPERIMENTS/shared-io-full/stripped/archive.savf 2","savf/SC-ILE/EXPERIMENTS/shared-io-none/stripped/archive.savf 2","savf/SC-ILE/FLOW/return-fixed-observable/archive.savf 1","savf/SC-ILE/FLOW/return-fixed-stripped/archive.savf 1","savf/SC-ILE/MONITOR/limits-observable/archive.savf 1","savf/SC-ILE/MONITOR/limits-stripped/archive.savf 1","savf/SC-ILE/MONITOR/stripped/archive.savf 2","savf/SC-ILE/TSTRIP-STRIPPED/archive.savf 2","savf/SC-ILE/TSTRIP/archive.savf 2"],"worse":[]},"full_check":{"exit":0,"seconds":772}} ```
Fixed-form calculations: CABxx, TAG and their C lines
All checks were successful
binjovi/ci Binjovi completed the frozen plan
4fc7b4adc4
The reader proves CABxx (the comparison, a jump on true to a jump to the
TAG label) and TAG (a codeless statement at a label that an unconditional
jump takes). With either, the emitter writes the calculations as C lines,
each taken only from the operations of its fixed form (Z-ADD, ADD, SUB,
MULT, IFxx, CABxx), and the first assignment declares a packed field in
columns 64 to 70. A literal compared with a field without a rescale takes
the field's decimal positions. FLOW/return-fixed matched on the host.
binjovi-bot manually merged commit 4fc7b4adc4 into trunk 2026-10-29 13:47:04 +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!671
No description provided.