An experimental multi-language transpiler framework. Parse source code from one language into a language-agnostic Intermediate Representation (IR), apply semantic passes, and generate source code in your target language.
- Multi-Source Parsing: Support for C, Go, Java, JavaScript, and Rust via tree-sitter, and Python via the standard library
astmodule. - Language-Agnostic IR: An internal representation covering common control flow, structs, arrays, maps, and casts.
- Intelligent Passes: A basic type-inference pass for
Any-typed locals. - Cross-Language Generation: Code generation for all six supported target languages, covering the common subset of each language's control flow and literal syntax.
This project is under active development. It handles core control flow (if/while/for/break/continue), function calls, structs, and casts across all six languages, but does not yet support exceptions, with/context-manager blocks, or non-range iteration in for loops — unsupported constructs raise a clear error at parse time rather than silently producing wrong output. See CLAUDE.md for the current, detailed list of what is and isn't supported.
pip install transpilergit clone https://github.com/ahron-maslin/transpiler.git
cd transpiler
pip install .For development (including testing and linting tools):
pip install -e ".[dev]"Use the transpiler CLI to convert code instantly:
# Convert a Python script to JavaScript
transpiler example.py --to js
# Convert a C header to Rust
transpiler header.c --to rustInput (Python):
def fib(n: int) -> int:
if n <= 1: return n
return fib(n - 1) + fib(n - 2)Command:
transpiler fib.py --to jsOutput (JavaScript):
function fib(n) {
if ((n <= 1)) {
return n;
}
return (fib((n - 1)) + fib((n - 2)));
}We value code quality and maintainability.
pytestWe use Ruff for linting and Black for formatting.
black src/ tests/
ruff check src/ tests/Ensure your changes meet our standards before committing:
pre-commit install- CI: Every PR and push to
mastertriggers our GitHub Actions suite, testing on Python 3.10-3.12. - Releases: Automated PyPI publishing on tag creation (e.g.,
git tag v0.1.0 && git push origin v0.1.0).
This project is licensed under the MIT License - see the LICENSE file for details.