Completed my submission for Port Mortem 2026 – Code Resurrection Hackathon!
Over the past few days, I worked on parsy-rs, an idiomatic Rust port of the Python Parsy parser combinator library.
At first glance, porting a parser library sounds like a straightforward language translation. In reality, it became an exercise in understanding language design, type systems, and preserving behavior across two very different ecosystems.
Python and Rust solve many of the same problems in fundamentally different ways.
Python gives you dynamic typing, generators, *args, **kwargs, and flexible runtime behavior.
Rust gives you ownership, lifetimes, traits, generics, and compile-time guarantees.
That meant this project was never about translating code line by line—it was about preserving the intent of the original library while designing APIs that feel natural in Rust.
Some interesting engineering decisions along the way:
- Implemented the core parser combinator framework in idiomatic Rust.
- Adapted optional() to Rust's Option model.
- Redesigned combine() and combine_dict() to work with Rust's strongly typed collections.
- Replaced Python-specific patterns with Rust-native abstractions using bind() and map().
- Intentionally omitted generate() because Python's generator coroutine model has no direct equivalent on stable Rust.
Beyond writing code, I wanted the repository to feel like a real open-source project.
The repository includes:
- Comprehensive documentation
- Engineering decision log (DECISIONS.md)
- Port status tracking
- Benchmark & validation documentation
- Extensive Rust unit tests and documentation tests
- Versioned releases and incremental commit history
A few project highlights:
- Python → 🦀 Rust
- 425 Rust unit tests passing
- 57 documentation tests passing
- Stable release build
- cargo fmt
- cargo clippy
- Production-ready repository structure
The biggest takeaway from this project:
Porting software isn't about translating syntax—it's about preserving behavior while embracing the strengths and constraints of the target language.
A huge thank you to Hackathon Raptors for organizing Port Mortem 2026. I really enjoyed working on a challenge that rewarded engineering discipline, thoughtful design decisions, and software quality rather than just generating code.
🔗 GitHub Repository:
https://github.com/shivansh023023/parsy-rs
Top comments (0)