Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Shared COBOL preprocessor in gitgalaxy/core: one layout/continuation/COPY/REPLACING/conditional expander with a line map, used by both the scanner and the COBOL→Java translator

Aperta
#5,648 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@squid-protocol ci sta già lavorando.

Dal 21/10/2026.

  • #5878 di @squid-protocol — aperta

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
38/100
Tipo di issue
Refactoring
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
compilers

Direzione di ricerca

Start by reading gitgalaxy/tools/cobol_to_java/det/source.py and gitgalaxy/core/mainframe_boundary.py, then inspect core/cobol_source_format.py, core/copy_libraries.py, and core.compiler_options for reusable behavior. The work spans a shared preprocessor, recursive COPY handling, substitutions, line mapping, removal of duplicate paths, tests, and documentation in docs/language_status/fact_ownership.md; done means both consumers use one module and all crucible, equivalence, and cross-check cases pass as specified.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

claim:nyx core-engine enhancement lane:nyx priority: high scope:core

Why

The scanner and the COBOL→Java translator each turn COBOL files into "the program the compiler sees", separately. The fact cross-check gate (#4273, fact-crosscheck.yml) catches them disagreeing, but not sharing a blind spot: on 2026-10-19 both missed COPY "ws-state.cpy". (scanner #5618 / PR #5626, translator #5645), so they agreed and the gate stayed green. BMS already follows the shared pattern (the translator imports core.bms_screen_fields / core.bms_symbolic), as do core.cobol_source_format, core.source_text.read_source and core.compiler_options. Do the same for the rest of the text-level front end.

What the preprocessor does (one module in gitgalaxy/core, no tree-sitter, zero-dependency)

Input: a COBOL source file + copy libraries. Output: the expanded program text plus a line map (every expanded line → original file and line).

  1. Layout: fixed format (sequence area 1-6, indicator 7: * / comment, D debug, - continuation; text past 72) and free format (*>), >>SOURCE FORMAT switching. Reuse core/cobol_source_format.py.
  2. Continuations: join continued literals and words (- in column 7).
  3. COPY: find COPY name [OF|IN lib] in every spelling (unquoted, quoted, quoted with extension "x.cpy"), resolve the member (core/copy_libraries.py, the engine already owns resolution since #4468), insert it, recursively, with cycle detection.
  4. Substitution: COPY … REPLACING (==pseudo-text==, partial words, :TAG: templates), the REPLACE statement, conditional compilation (>>IF/>>ELSE/>>END-IF, >>DEFINE) per the compiler options already parsed by core.compiler_options.
  5. Line map, so findings and generated Java point at CUSTREC.cpy:12, not a line of the expanded text.
    Out of scope: EXEC SQL/CICS/DLI blocks pass through untouched; statement parsing and record layouts stay where they are (the translator's tree-sitter grammar is byte-proven against GnuCOBOL, #4378).

Where it replaces duplicate code

  • Translator: gitgalaxy/tools/cobol_to_java/det/source.py expand() (:728), _replacing/_replace (:809/:820), copy_names/_copy_match/_COPY (:652-:665), comment/free-format helpers (:288, :574, :581), as_fixed/as_fixed_rows (:1001).
  • Scanner: gitgalaxy/core/mainframe_boundary.py _copy_replacing (:641), _continued_literal (:552); the REPLACING application in gitgalaxy/tools/cobol_to_cobol/galaxy_ir.py (#4457); any COPY regex in standards/language_standards/languages/cobol.py.

Acceptance

  • One module used by both sides; the translator and the scanner no longer contain their own COPY/REPLACING/continuation code.
  • Fixes #5645 (translator COPY "x.cpy".) here; the scanner fix from #5618/PR #5626 is subsumed (keep its tests).
  • Re-proof: every crucible port and equivalence case still passes byte-for-byte (CICS crucible, estate crucible, golden crucible), the fact cross-check ledger does not grow (it should shrink where the two sides now share text), COBOL goldens unchanged or drift explained.
  • Tests per step and shape, fixed and free format, our own fixtures (licensing rule: no third-party code).
  • Note in docs/language_status/fact_ownership.md: the expanded text is a shared input, no longer a duplicated channel.

Part of the CICS→Java path (Training Montage). Follow-up: #5649 (translator consumes engine layouts).

🤖 Generated with Claude Code

Lingua principale
Python
Stelle
57
Fork
11
Merge medio
1h 51m
PR unite (30g)
982

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di squid-protocol/gitgalaxy

Tutte le issue di squid-protocol/gitgalaxy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.