Skip to main content

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.

CI PyPI License: MIT

✨ Features

  • Multi-Source Parsing: Support for C, Go, Java, JavaScript, and Rust via tree-sitter, and Python via the standard library ast module.
  • 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 master triggers 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

transpiler-1.0.0.tar.gz (35.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

transpiler-1.0.0-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

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

Hashes for transpiler-1.0.0.tar.gz
Algorithm Hash digest
SHA256 70c76bafac6abd8065b884f1bb5913c3d24e10fb0cf1d0503109cf9c900dc34a
MD5 6522d125a935ce0f1d75f69f24027602
BLAKE2b-256 9e4659f66d124db3f20989eeffd82c1397689e07d0291d1f7fa48eba39646839

See more details on using hashes here.

Provenance

The following attestation bundles were made for transpiler-1.0.0.tar.gz:

Publisher: ci.yml on ahron-maslin/transpiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for transpiler-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26b148fe2bd526031197ff8905cd7875cf29b134ab3957e05b5a074910f8919b
MD5 9869e2454c74fa9de5ffac9103a525bb
BLAKE2b-256 84bd2d7a0526054674470c46429db28879073f852c7cfcddda8da13ff7c36c4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for transpiler-1.0.0-py3-none-any.whl:

Publisher: ci.yml on ahron-maslin/transpiler

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page