COBOL to Kotlin via Formal Models (IR and Alloy and Golden Master)
8 comments
·November 8, 2025bigdatajs
The problem I have with all Cobol translation models is that it completely ignores the actual modernization of the system. You've traded one type of syntactic sugar with another.
agumonkey
you mean cobol 2002+ revisions ?
dfboyd
Isn't the first code sample pasted in there twice?
Jtsummers
Yes, starting at:
STOP RUN.```cobol
Then the code repeats.marcoeg
I’ve been experimenting with formal, verifiable modernization and taking a small COBOL batch program and translating it through an intermediate representation and Alloy formal model into Kotlin, while proving equivalence with the legacy output.
Repo: https://github.com/marcoeg/cobol-modernization-playbook
Would love feedback from people who’ve worked on reverse engineering or legacy transformations at scale.
tshanmu
how are you creating the IR?
> 1. Both systems run with the same fixed input files (data/accounts.dat, data/txns.dat).
> 2. Each writes its results to out/accounts_out_*.dat.
> 3. Python scripts convert fixed-width output to CSV and compute SHA-256 checksums.
> 4. If the hashes match — behavior is proven identical.
Step 3 above introduces the possibility that the python scripts alter the output in such a way that the outputs don't actually match prior to the python.
I'm curious why step 3 is not "If the two outputs match — behavior is proven identical."