Skip to content

Latest commit

 

History

318 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loom – Legacy Code Modernization Toolkit

License: MIT Rust Platform

Loom is extensible tool that translates legacy code (COBOL, RPG, PL/I) into modern languages (Python, JavaScript, C#, Go, Rust, TypeScript, Kotlin, Swift, Zig, Nim, Dart). It validates translations using an interpreter and supports incremental migration via a strangler-fig pattern.


Features

Area Description
Legacy languages COBOL, RPG, PL/I – easily add more via hand-written or pest grammars
Target languages 11 modern languages: Python, JavaScript, C#, Go, Rust, TypeScript, Kotlin, Swift, Zig, Nim, Dart
Statements ADD, MOVE, IF/ELSE, PERFORM (subroutines), WHILE loops, DISPLAY, EVALUATE, file I/O (OPEN, READ, WRITE, CLOSE)
Validation Built-in interpreter compares legacy vs. translated output; can record/load test cases
Migration Generates strangler-fig wrappers for incremental replacement
Resource usage Compiled Rust binary, no garbage collector, minimal memory footprint

Installation

Prerequisites

  • Rust (1.70 or later)
  • (Optional) Python 3 – for validation runner

Build from source

git clone https://github.com/tayebmekati37-art/loom.git
cd loom
cargo build --release

The binary is located at:

target/release/loom

(or loom.exe on Windows)


Usage

loom translate -f -l -t loom validate -f -l [-v key=value] [--record] loom migrate -l [-m ] -t


Supported Legacy Languages (-l)

Language Flag Example Extension

Simple simple .legacy COBOL cobol .cob, .cbl RPG rpg .rpg PL/I pli .pli


Supported Target Languages (-t)

python, javascript, csharp, go, rust, typescript, kotlin, swift, zig, nim, dart


Examples

  1. Translate a COBOL program to Python

Input (test.cob):

MOVE 5 TO X ADD 10 TO X DISPLAY X

Command:

loom translate -f test.cob -l cobol -t python

Output:

def translated_func(): x = 5 x = x + 10 print(x)


  1. Validate with random test cases

loom validate -f test.cob -l cobol --record

Saves test cases to:

test.cob.tests.json

Next run without --record will reuse them.


  1. Generate a migration wrapper

loom migrate -l legacy.cob -m modern.py -t python

Outputs a Python wrapper that routes calls between the two versions.


Architecture

Legacy Code → [Parser] → IR → [Translator] → Modern Code ↘ [Interpreter] → Validation ↘ [Migration] → Wrapper

IR – language-agnostic AST (defined in ir.rs)

Interpreter – runs the IR for validation

Validation – compares interpreter output with generated code; records/loads test cases

Migration – generates strangler-fig wrappers


License

MIT © Tayeb Mekati – see LICENSE for details.

About

Loom is a lightweight, extensible tool that translates legacy code (COBOL, RPG, PL/I, and a simple mini‑language) into modern languages (Python, JavaScript, C#, Go, Rust, TypeScript, Kotlin, Swift, Zig, Nim, Dart). It validates translations using an interpreter or real legacy execution.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages