Skip to content

NervaPack v0.7.0 — RPG/CL/COBOL (IBM i) support

Choose a tag to compare

@ramdhavepreetam ramdhavepreetam released this 05 Aug 15:34
· 24 commits to master since this release

RPG, CL, and COBOL support for IBM i / mainframe codebases

NervaPack v0.7.0 makes the IBM i / mainframe stack first-class in the knowledge graph. Previously, RPG, CL, and COBOL files were skipped silently — they have no tree-sitter grammar on PyPI, so they never reached the parser. This release adds a dedicated pure-Python extractor path for them, alongside the existing tree-sitter path.

Bundled and always on — no extra to install, no grammar to compile. Works offline and in air-gapped / corporate networks, consistent with NervaPack's privacy-first design.

Extensions indexed

Language Extensions
RPG .rpgle, .rpg, .sqlrpgle
CL .clle, .clp, .cl
COBOL .cbl, .cob, .cobol, .cpy

Both fixed-form and free-form source are handled.

What you get

  • Symbol nodes — RPG procedures, CL programs/subroutines, COBOL programs, divisions, sections, and paragraphs.
  • Typed dependency edges — so the call graph and copybook-usage graph are separately queryable:
    • CALL / CALLP / CALLPRCCALLS
    • /copy / COPYCOPIES
    • CL DCLF FILE(...)DECLARES_FILE
  • Cross-file and cross-language resolution — an RPG program that calls a COBOL program produces a real CALLS edge between them. Each edge carries the source line.
  • Short-name linking — IBM i names are frequently ≤ 4 chars (ORD, TAX, AR100); these now link correctly (the old length floor no longer drops them).
  • Copybook resolution — a bare copybook (.cpy with only data items) becomes a module node so COPY MEMBER resolves to it.
  • No fabricated edges — a CALL/DCLF to a target that isn't in the indexed tree produces no edge.

Example

CALLS   RUN (CL)   → ORD (RPG)    — cross-language, 3-char names
CALLS   ORD (RPG)  → TAX (COBOL)  — cross-language
COPIES  TAX (COBOL)→ EMPREC.cpy   — copybook dependency

This turns a sprawling green-screen program inventory into a navigable, connected map — for onboarding, "what breaks if I change this," and feeding an LLM during modernization at a fraction of the tokens of raw source.

Getting started

pip install -U nervapack
nervapack ingest /path/to/ibmi/source

Full details: IBM i Languages documentation.

Implementation notes

  • New module nervapack.parser.regex_extractors (extract_rpg / extract_cl / extract_cobol).
  • LanguageConfig gains an optional regex_extractor; grammar_loader is now Optional. ASTParser.parse_file branches to the extractor when one is registered — no CLI changes.
  • Graph builder emits the typed edges from import metadata and relaxes the name-length floor for regex-parsed entities; a generic reference never overwrites a typed edge.
  • Fully tested: tests/test_ibmi_parsers.py (23 cases); full suite green; docs build clean under --strict.

Out of scope (candidates for future work)

Data-structure / field-level modeling, dynamic (variable) calls, embedded-SQL parsing inside .sqlrpgle, and tree-sitter grammar vendoring.


Full changelog: https://github.com/ramdhavepreetam/NervaPack/blob/master/docs/changelog.md
PyPI: https://pypi.org/project/nervapack/0.7.0/