pro-grammer-SD/p2r
๐๐ A static Python-to-Rust transpiler that converts type-annotated Python code into performant and idiomatic Rust, with built-in compilation and execution.
What's novel
๐๐ A static Python-to-Rust transpiler that converts type-annotated Python code into performant and idiomatic Rust, with built-in compilation and execution.
Code Analysis
9 files read ยท 4 roundsA single-file Python transpiler that parses annotated Python code into an intermediate representation and generates equivalent Rust source files.
Strengths
Clean IR design with strong separation of concerns between parsing, type checking, and code generation. The use of dataclasses for the AST/IR is idiomatic and readable. It handles a surprising amount of Python syntax (loops, conditionals, comprehensions) in a single file without external dependencies.
Weaknesses
Dangerous reliance on `.unwrap()` throughout the compiler logic, which will cause crashes on edge cases rather than providing helpful errors. Lack of unit tests for the transpiler logic itself; testing is limited to running a demo executable. The code generation phase (IR -> Rust string) was not visible due to truncation, but the minimal test suite suggests it may be fragile.
Score Breakdown
Signal breakdown
Innovation
Craft
Traction
Scope
Evidence
Commits
6
Contributors
1
Files
11
Active weeks
1
Repository
Language
Python
Stars
5
Forks
0
License
MIT