Skip to main content

transpiler python into other language

Project description

Kithon is a project that provides the ability to translate python and python-family language such as hy-lang and coconut into human-readable code in any other programming languages.

Try out the web demo or install locally: pip install kithon. Then you can use generation to js or go or create custom transpiler.

Example

# main.py

def main():
    print('Hello, Kithon')

main()

kithon gen --to js main.py, output:

function main() {
    console.log("Hello, Kithon");
}
main();

kithon gen --to go main.py, output:

package main
import (
	"fmt"
)

func main() {
    fmt.Println("Hello, Kithon")
}

For what?

For use python where we can't. For example in browser(js), embedded scripting(mostly lua). Or make python program faster by translating to go, c++, rust, nim or julia. Also for supporting program written on in unpopular programming languages (very new or vice versa)

How it works?

Kithon uses a dsl based on yaml and jinja to apply the rules described on it to the nodes of the ast tree. Using this dsl you can add new languages or extensions to those already added.

Status

The project is under active development. Now the ability to add translation of basic python constructs into any other language(in this repo js and go only) is supported.

There are plans to develop a number of supported languages and expand support for python syntax

Similar projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kithon-0.3.0.post1.tar.gz (23.6 kB view details)

Uploaded Source

Built Distribution

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

kithon-0.3.0.post1-py3-none-any.whl (32.4 kB view details)

Uploaded Python 3

File details

Details for the file kithon-0.3.0.post1.tar.gz.

File metadata

  • Download URL: kithon-0.3.0.post1.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.4.164-1-MANJARO

File hashes

Hashes for kithon-0.3.0.post1.tar.gz
Algorithm Hash digest
SHA256 fac71e2fdcb3d50ad03c5b4ed32defe27db35c2ffa0307852aa0a5878b15eab1
MD5 8ba755be23905003ba1d5f3669faf324
BLAKE2b-256 7d653a6bbcb8e3e44ac72a37ba85467b78c42ab30fb7eaae8e117c67ea5467ec

See more details on using hashes here.

File details

Details for the file kithon-0.3.0.post1-py3-none-any.whl.

File metadata

  • Download URL: kithon-0.3.0.post1-py3-none-any.whl
  • Upload date:
  • Size: 32.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.9 Linux/5.4.164-1-MANJARO

File hashes

Hashes for kithon-0.3.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 931fbdd19564a511afded4df239baa4952a4126349fa3ae88dbb198bb186eefd
MD5 bf3d3296089c6a232bce9194a70a3631
BLAKE2b-256 ada5c3ec371f0bb50cb466e885ed5cc6753eb9d3f2ee04ea256ffca37b8cc738

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page