Arun Sharma · February 22, 2021

py2many transpiler

py2many is a python -> {c++14, rust, go, julia, kotlin, dart, nim} transpiler written in python.

Recent improvements

  • IntEnum/IntFlag support: rust/go/nim support it. The other languages need work.
  • Integer overflow mitigation: most languages now use inferred types as opposed to defering to lanugage specific type inference (e.g. C++ auto).
  • Streamline function call dispatch and remove the copy-pasta from pyrs

Future Plans

There are several transpiler projects that once had a large mindshare, but have petered out after several years of inactivity.

  • grumpy
  • rusthon
  • py2nim
  • py2jl

among others. Trying to learn from their experiences and finding potential collaborators is going to take time.

In the meanwhile, I’m thinking of a few potential directions:

  • Plugin system to write user defined function maps. Look for small_dispatch_map in the code for examples.
  • Map python module system to other languages
  • Write a small runtime. Golang doesn’t have an ergonomic range(3, 9, 2) for example.

Are there other features you think py2many should prioritize? Do drop me a line.

Twitter, Facebook


You can use your Mastodon account to reply to this post.