cobol-parser
Python library for parsing IBM Enterprise COBOL source into an AST. Supports dependency extraction, dead code detection, program flow analysis, and CRUD matrices. 99.1% parse success on the NIST COBOL-85 corpus.
Install
pip install -e ".[dev]"
Requires Python 3.11, 3.12, or 3.13.
Install the CLI globally (uv)
To get the cobol-parser command on your PATH in any directory, without
setting up a project virtualenv:
uv tool install . # from a clone of this repo
uv tool install --editable . # dev mode: picks up code changes without reinstalling
uv tool install builds the Cython fast-path extensions as part of the
install, so the CLI runs at full speed. Verify it worked from anywhere:
cobol-parser --version
After pulling new commits (non-editable install only), rerun uv tool install . --reinstall to update.
Quick Start
from cobolparser import parse_cobol
result = parse_cobol(source, filename="prog.cbl")
if result.success:
print(result.ast.program_name)
print(result.ast.to_json())
CLI:
cobol-parser parse program.cbl
cobol-parser analyze program.cbl # dynamic call analysis
cobol-parser dead-code program.cbl # unreferenced paragraphs
Generate test data from a copybook
gen-data turns a copybook record layout into a CSV of synthetic records —
one column per elementary field, values that always fit the field's PICTURE,
USAGE, and level-88 domain:
cobol-parser gen-data CUSTOMER.cpy --rows 100 --seed 7 -o customers.csv
from cobolparser.generators import CopybookDataGenerator, DataGeneratorOptions
dataset = CopybookDataGenerator(
DataGeneratorOptions(rows=100, seed=7)
).generate_from_file("CUSTOMER.cpy")
print(dataset.to_csv())
A seed makes output byte-identical across runs; omit it and the seed that
was drawn is reported on dataset.seed (and by gen-data --describe) so any
run can be replayed. REDEFINES and FILLER are excluded by default, and
OCCURS tables expand to one column per occurrence.
Commands
# Tests
python -m pytest tests/ -v
python -m pytest --cov=cobolparser --cov-report=html
# Lint / format / type-check
ruff check .
black .
mypy cobolparser/
Documentation
Full reference: .okf/index.md
License
Proprietary — Copyright © 2026 Samuel Dion. All rights reserved. See LICENSE.
Metadata
Release files for cobol-parser 1.7.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 180.1 MB
Release files / cobol_parser-1.7.8-cp313-cp313-win_amd64.whl
| Download URL | cobol_parser-1.7.8-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
31a6f101b3aa745c78e81d8f9b082dd4653fa4c889beeb244d4b5d7e33977b5b
|
|
BLAKE2b-256 checksum How to use checksums |
c4d58db441dcf73f5f3b69b412d9de2c8a48169f327771b1a57ea2e52e9f5c11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cobol_parser-1.7.8-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 46.3 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
c3be0df23876a44a178264cf2ee6cd61a92c2b8f27fc77db2ff985a9c3be0c5b
|
|
BLAKE2b-256 checksum How to use checksums |
cf74db0bfba0bb4a3aacb8ec8a5009d69530075ff201a4baffbf2e5e059dc3ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp313-cp313-macosx_11_0_arm64.whl
| Download URL | cobol_parser-1.7.8-cp313-cp313-macosx_11_0_arm64.whl |
|---|---|
| Size | 6.9 MB |
| Tags | CPython 3.13 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
23098ef0bd4f7848aa3b428346f7a26061ef77f6afdd61a983b1404a0651db3e
|
|
BLAKE2b-256 checksum How to use checksums |
7d0f873f313833491bf3e4f8fc135f13209c6feb967c0bf90f93fa305ae3c494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp312-cp312-win_amd64.whl
| Download URL | cobol_parser-1.7.8-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 6.1 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
74ad724c130f4633d07c4b9cac52d3169eeb954960458d1823dfc5f13adabfd7
|
|
BLAKE2b-256 checksum How to use checksums |
04fda8bdfef6e9f06016f770577549d60066b60829cbbfee8ddc5572aaca8713
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cobol_parser-1.7.8-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 47.2 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
a68dfa1cb0b649c7d38236d96fb52854b288c57f58b774314b16c83f19fe93a7
|
|
BLAKE2b-256 checksum How to use checksums |
ceba5596fee6a40969e296674a0b55775ed383626f104bbeb93db372b227756f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp312-cp312-macosx_11_0_arm64.whl
| Download URL | cobol_parser-1.7.8-cp312-cp312-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.0 MB |
| Tags | CPython 3.12 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1ac071e02a7b91079302ca3a9e5efef2e45a050f61a573d545fb8bab545545b1
|
|
BLAKE2b-256 checksum How to use checksums |
746a20a927e5072591d8793cb0931350a2f06109bf45d4226252ee1a463ecfa0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp311-cp311-win_amd64.whl
| Download URL | cobol_parser-1.7.8-cp311-cp311-win_amd64.whl |
|---|---|
| Size | 6.3 MB |
| Tags | CPython 3.11 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
9622a23eaad6fe93d6b7fc842e7b556db4339f16efb0bb2655e866476f784806
|
|
BLAKE2b-256 checksum How to use checksums |
9a73d1d3ca5bd21ecc1e335c534c4e69f771e47a9b515d5d99917ff3093d86b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | cobol_parser-1.7.8-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 47.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
fff285caaf1aba1eb73714ee757aeea7aba0d4c60fd2b79b064605a2ce745bb0
|
|
BLAKE2b-256 checksum How to use checksums |
f6a55991ee85a448c560aea86fc42ae271790f863f5ced483ce554a4c46ae02b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / cobol_parser-1.7.8-cp311-cp311-macosx_11_0_arm64.whl
| Download URL | cobol_parser-1.7.8-cp311-cp311-macosx_11_0_arm64.whl |
|---|---|
| Size | 7.0 MB |
| Tags | CPython 3.11 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
72685702ee8a35b9dcf5736fc595e87f063eb37a691b2dfe57e913172c903bb4
|
|
BLAKE2b-256 checksum How to use checksums |
1de9d88fe149ae01330bbadbd5040a4c194399267592e3e5af4853705ffeabd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency log