Transpiler 🚀
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.
✨ Features
- 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.
🛠 Installation
From PyPI
pip install transpiler
From Source
git clone https://github.com/ahron-maslin/transpiler.git
cd transpiler
pip install .
For development (including testing and linting tools):
pip install -e ".[dev]"
🚀 Quick Start
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 rust
Example
Input (Python):
def fib(n: int) -> int:
if n <= 1: return n
return fib(n - 1) + fib(n - 2)
Command:
transpiler fib.py --to js
Output (JavaScript):
function fib(n) {
if ((n <= 1)) {
return n;
}
return (fib((n - 1)) + fib((n - 2)));
}
🧪 Development
We value code quality and maintainability.
Running Tests
pytest
Linting & Formatting
We use Ruff for linting and Black for formatting.
black src/ tests/
ruff check src/ tests/
Pre-commit Hooks
Ensure your changes meet our standards before committing:
pre-commit install
📦 CI/CD
- 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).
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file transpiler-1.0.0.tar.gz.
File metadata
- Download URL: transpiler-1.0.0.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70c76bafac6abd8065b884f1bb5913c3d24e10fb0cf1d0503109cf9c900dc34a
|
|
| MD5 |
6522d125a935ce0f1d75f69f24027602
|
|
| BLAKE2b-256 |
9e4659f66d124db3f20989eeffd82c1397689e07d0291d1f7fa48eba39646839
|
Provenance
The following attestation bundles were made for transpiler-1.0.0.tar.gz:
Publisher:
ci.yml on ahron-maslin/transpiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transpiler-1.0.0.tar.gz -
Subject digest:
70c76bafac6abd8065b884f1bb5913c3d24e10fb0cf1d0503109cf9c900dc34a - Sigstore transparency entry: 2125993845
- Sigstore integration time:
-
Permalink:
ahron-maslin/transpiler@1bde2b8e9d859478a5ad36121775e56522e25805 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ahron-maslin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1bde2b8e9d859478a5ad36121775e56522e25805 -
Trigger Event:
push
-
Statement type:
File details
Details for the file transpiler-1.0.0-py3-none-any.whl.
File metadata
- Download URL: transpiler-1.0.0-py3-none-any.whl
- Upload date:
- Size: 36.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26b148fe2bd526031197ff8905cd7875cf29b134ab3957e05b5a074910f8919b
|
|
| MD5 |
9869e2454c74fa9de5ffac9103a525bb
|
|
| BLAKE2b-256 |
84bd2d7a0526054674470c46429db28879073f852c7cfcddda8da13ff7c36c4e
|
Provenance
The following attestation bundles were made for transpiler-1.0.0-py3-none-any.whl:
Publisher:
ci.yml on ahron-maslin/transpiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
transpiler-1.0.0-py3-none-any.whl -
Subject digest:
26b148fe2bd526031197ff8905cd7875cf29b134ab3957e05b5a074910f8919b - Sigstore transparency entry: 2125994337
- Sigstore integration time:
-
Permalink:
ahron-maslin/transpiler@1bde2b8e9d859478a5ad36121775e56522e25805 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/ahron-maslin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@1bde2b8e9d859478a5ad36121775e56522e25805 -
Trigger Event:
push
-
Statement type: