Skip to content

fix(yacc): route grammar-rule slicing through Mode A; map ctags 'l' kind; validate tri-comparison shape - #2353

Merged
squid-protocol merged 2 commits into
mainfrom
fix/yacc-tri-comparison
Aug 27, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/yacc-tri-comparison

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What

Validates the tri-comparison ledger shape yacc/function/existence/agree[gitgalaxy]_vs[ctags]
(18 occurrences, first seen 2026-08-27 once #1926 let the .y corpus files into file_data),
via the tri-comparison-ledger-sweep skill. GitGalaxy was correct on all 18. The shape had two
independent causes, both fixed here, plus a third finding logged to why_gitgalaxy_beats_ast_here.md.

Cause 1 — engine recall gap (detector.py) — fixes #2351

yacc had no ScopeParsingRegistry entry and lexical_family="standard_block", so it routed to
Mode_B_Braces. A yacc grammar rule only has a {} pair when a production carries a C semantic
action, so every action-less rule (Configuration:, Many_specs:, Opt_list:, …) couldn't
be brace-sliced and was dropped from function_data — even though the raw struct_func_start
signal counted it.

file raw signal named (before) named (after) ctags
freebsd/config.y 20 11 20 20
gnucobol_internals/parser.y 1148 781 1148 823

Same bug class as #1899 (abap) / #1975 (jcl, m4) / dockerfile. Fixed by routing yacc through
Mode_A_Labels — "greedy to the next rule head" is the correct body boundary for a non-nesting
grammar-rule language, exactly like COBOL's label-only paragraphs. .l/.ll (lex/flex) share
the rule set and are fixed by the same change.

Cause 2 — test-harness kind-map bug (ctags_reader.py) — fixes #2352

CTAGS_FUNC_KINDS["yacc"] was set(), with a comment claiming ctags "structurally cannot see"
grammar rules. ctags --list-kinds-full=YACC shows l (label) is the parser's only kind and it
tags every rule LHS with it. Mapped {"l"} — same precedent as makefile t / assembly l,
same gap shape as the fixed cpp g / kotlin o / fortran m,i,S,b entries. After both fixes
GitGalaxy and ctags agree exactly on all 27 rules across the gather corpus.

Cause 3 — why_gitgalaxy_beats_ast_here.md Claim 12, second instance

On gnucobol_internals/parser.y (real 18k-line Bison grammar) GitGalaxy finds 1148/1148 real
rules at 100% precision vs ctags' 823. ctags' YACC parser emits no tag for any rule whose
name starts with _ (GnuCOBOL's pervasive optional-nonterminal convention — 325 rules) or for a
single-character name (x:), and wrongly tags one rule (encryption_clause:) that sits entirely
inside a /* ... */ block comment. Same lexical-coverage mechanism as Claim 12's existing AGC
assembly evidence.

Ledger / chart

  • tri_comparison_ledger.json: yacc entry → validated, still_reproduces=false, full verdict.
    credit_tools/debit_tools both empty (shape resolved into genuine agreement).
  • tri_comparison_chart.svg regenerated with real universal-ctags on PATH; diff scoped to the
    yacc row (18*/0* → 27/27 tie) plus the global summary counters (63 → 64 comparisons).
  • New docs/language_status/yacc.md with the §9 tri-comparison capstone.

Differential Scan

Both golden masters re-blessed. Semantic leaf-diff = 8634 changes, entirely in
cobol/gnucobol_internals/parser.y (+367 real rules × ~20 metric fields + list re-sort), the
yacc/freebsd/* corpus files, and topological-coordinate ripple on neighbouring files in the same
repos. Zero structural-signature changes outside .y/.l files.

Verification

  • test_yacc.py / test_yacc_strict.py: 68 passed, 1 skipped
  • tests/core_engine/: 558 passed
  • audit_check.py (ruff / mypy / dead-key / ast-accuracy): all clear
  • crucible_check.py full corpus: drift confined as described above, golden masters re-blessed

Known residual (accepted, documented in yacc.md §5)

Mode A's last matched rule per file greedily absorbs the trailing C epilogue as its "body"
(inflated LOC/complexity on that one function) — identical to every other Mode A language at
end-of-segment. Existence/precision unaffected.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 27, 2026 18:20
…s 'l' kind

yacc had no ScopeParsingRegistry entry and lexical_family=standard_block, so
detector.py routed it to Mode_B_Braces. A yacc grammar rule only has a {}
brace pair when a production carries a C semantic action, so every action-less
rule (Configuration:, Many_specs:, Opt_list:, ...) was counted in the raw
struct_func_start signal but silently dropped from the named function_data list.
Same bug class as #1899 (abap) / #1975 (jcl, m4) / dockerfile. Fixes #2351.

  config.y:  function_count 11 -> 20 (raw signal was already 20)
  parser.y (gnucobol):  781 -> 1148, now 100% precision

Add "yacc" to the Mode_A_Labels branch: "greedy to the next func_start" is the
correct body boundary for a non-nesting grammar-rule language, exactly like
COBOL's label-only paragraphs. .l/.ll (lex/flex) share the rule set.

Also fix tests/tools/ctags_reader.py: CTAGS_FUNC_KINDS["yacc"] was set() with a
comment claiming ctags "structurally cannot see" grammar rules. It can -- ctags'
YACC parser tags every rule LHS with kind 'l' (label), confirmed via
`ctags --list-kinds-full=YACC`. Map it, same precedent as makefile 't' /
assembly 'l'. This is the cpp 'g' / kotlin 'o' kind-map gap shape. Fixes #2352.
After both fixes GitGalaxy and ctags agree exactly on all 27 corpus rules.

Golden masters re-blessed: semantic diff is 8634 leaves, all in
cobol/gnucobol_internals/parser.y (+367 real rules x ~20 metric fields, list
re-sorted by impact), the yacc/freebsd corpus files, and topological-coordinate
ripple on neighbouring files in the same repos (no structural-signature change
outside .y/.l files).

Surfaced by the tri-comparison-ledger-sweep skill validating
yacc/function/existence/agree[gitgalaxy]_vs[ctags].

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…instance

Validates yacc/function/existence/agree[gitgalaxy]_vs[ctags] (18 occ, first
seen 2026-08-27). GitGalaxy was correct on all 18; shape resolved by the two
fixes in the parent commit (#2351 engine, #2352 harness) and no longer
reproduces -- chart cell 18*/0* -> verified 27/27 tie, no asterisk.

- tri_comparison_ledger.json: yacc entry -> status=validated, still_reproduces
  =false, full verdict. credit_tools/debit_tools both empty (shape resolved
  into genuine agreement, not an uncorroborated single-tool claim).
- tri_comparison_chart.svg / points_of_interest.md: regenerated (--all --write,
  real universal-ctags on PATH); diff scoped to the yacc row + global summary
  counters (63 -> 64 real comparisons).
- why_gitgalaxy_beats_ast_here.md: second confirmed instance of Claim 12
  (lexical coverage a generic parser's identifier convention excludes) --
  ctags' YACC parser emits no tag for `_`-prefixed rule names (325 in
  gnucobol/parser.y) or single-char names (`x:`), and tags a rule that is
  entirely inside a block comment.
- docs/language_status/yacc.md: new status doc, §9 tri-comparison capstone.
  README table row -> written.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@squid-protocol
squid-protocol merged commit 1f1c2b3 into main Aug 27, 2026
28 checks passed
@squid-protocol
squid-protocol deleted the fix/yacc-tri-comparison branch August 27, 2026 22:27
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant