Skip to content

det parse: abbreviated 'OR NOT = x' relation; pin conditions holes 1-2 (#4681) - #4683

Merged
squid-protocol merged 13 commits into
mainfrom
fix/4681-condition-holes
Oct 8, 2026
Merged

squid-protocol merged 13 commits into
mainfrom
fix/4681-condition-holes

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #4681

stacked on #4677 (-> #4654) -- merge those first

Tests: tests/cobol_mainframe/test_det_conditions.py (cobc vs port, bytes and typed; hole 3 fails before, holes 1 and 2 pass before and after). det_port.py check vs #4677: 68/68 ports unchanged. pr_gates --fast 5/5, --ratchets 7/7, evidence_report --check clean.

🤖 Generated with Claude Code

squid-protocol and others added 5 commits October 7, 2026 21:17
…SVS does (#4287)

The det translator replays cobc -std=ibm's compile-time ARITHMETIC-OSVS decision
(det/osvs.py, from GnuCOBOL 3.1.2 typeck.c / tree.c): dmax from receivers and
cb_walk_cond, the expr_decp stack with its pushes, pending aligns flushed on the
next load, constant folding, conditions built right to left, the state an
EVALUATE leaves to its sentence. It emits Cobol.align (libcob's
cob_decimal_align, its downward shift included) where cobc emits
cob_decimal_align, and a literal on the right of an operation as a Cobol.Dc
(libcob's decimal constant, whose scale its uses change). Cobol.divide keeps
cob_decimal_div's places and Cobol.power cob_decimal_pow's trimming.

Register C2 rewritten: the det runtime matches the oracle; the oracle's
departures from IBM's rule are listed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The oracle (GnuCOBOL 3.1.2 -std=ibm) leaves every receiver unchanged on a zero
divisor, with or without ON SIZE ERROR; the det port threw ArithmeticException.
Cobol.divide now returns libcob's NaN (scale -32768) and raises the statement's
size error; add/subtract/multiply/negate/power carry it where the translator sees
a division or exponent below; store/storeChecked leave the receiver (lifted
receivers guarded with isNan); Cobol.align truncates a NaN to 0 as libcob does.
A division in a function argument is 0 (cob_intr_binop); FUNCTION MOD/REM by
zero are 0. 0 ** 0 raises the size error; a non-finite exponent is NaN.
Statements with ON SIZE ERROR clear and read the size-error state.
DIVIDE REMAINDER now uses the quotient truncated to the receiver's places
(cob_div_quotient), not the stored quotient.

Register entry oracle_assumptions C14 (IBM: undefined / S0CB on z/OS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…4655)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…es (#4681)

Holes 1 and 2 (D0 + 1 > Q3, S3 NOT < 3 + B0 * - D0) already agree with cobc on this base (#4654/#4677); an end-to-end test pins them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread gitgalaxy/tools/cobol_to_java/det/gen.py Fixed
Comment thread gitgalaxy/tools/cobol_to_java/det/osvs.py Fixed
Comment thread tests/cobol_mainframe/test_det_osvs.py Fixed
Comment thread tests/cobol_mainframe/test_det_size_error.py Fixed
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

squid-protocol and others added 8 commits October 8, 2026 10:46
expr imported det.cics (for DFHRESP) and det.cvda lazily, and det.cics imported det.gen, which imports det.osvs, which imports expr. expr now imports DFHRESP from gitgalaxy.standards.cics.resp (its home) and CVDA from det.cvda (no imports) at module level, so expr no longer reaches gen. Also one import form for test_det_programs in test_det_osvs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
# Conflicts:
#	gitgalaxy/tools/cobol_to_java/det/expr.py
Conflicts in oracle_assumptions.md, Cobol.java and gen.py came from #4654's
pre-squash commits: main's side taken, then this PR's own changes
(6e1de82..f6da8e4) re-applied on top.

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

stmt.py: main's _join_not_breaks (#4680) runs first, then this PR's
abbreviated AND/OR NOT = rewrite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
oracle_assumptions.md: both register entries kept, C13 (#4668) then C14
(this PR), in the table and the sections.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
…/4681-condition-holes

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
@squid-protocol
squid-protocol marked this pull request as ready for review October 8, 2026 21:14
@squid-protocol
squid-protocol merged commit 296cd4d into main Oct 8, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the fix/4681-condition-holes branch October 8, 2026 21:14
squid-protocol added a commit that referenced this pull request Oct 8, 2026
…merged)

The conflicts were #4677's pre-squash commits against its squash (identical
trees): this branch's side kept; #4683's stmt.py / test_det_conditions.py
merged as main has them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MQNoe4wPJgr7dbUvs3DG6D
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.

det translator: arithmetic-vs-scaled-item comparison differs from cobc; 'OR NOT = x' does not parse

2 participants