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
Release history Release notifications | RSS feed
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
Hashes for kithon-0.3.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 931fbdd19564a511afded4df239baa4952a4126349fa3ae88dbb198bb186eefd |
|
MD5 | bf3d3296089c6a232bce9194a70a3631 |
|
BLAKE2b-256 | ada5c3ec371f0bb50cb466e885ed5cc6753eb9d3f2ee04ea256ffca37b8cc738 |