go2hx
A Go to Haxe transpiler and spiritual sucessor to the Tardisgo project with notable design improvements.
Improvements:
- AST instead of SSA types that allows much nicer looking final generated code, and less overhead.
- Haxe focused/maintained, example: low level parts of the Go’s standard library is being written by hand, in Haxe (os,fmt,math etc)
- Haxe has improved immensly since 2016, specfically for this project: unicode support, rest arguments, module level functions etc.
- Language features in Go and not in Haxe are supported via macros such as multireturns, defers, gotos, pointers etc.
Current state:
- Can generate all expressions/statements, except one’s releating to goroutines
- Able to run simple scripts that use parts of the standard library that are written.
- About 8% of the low level std is written in Haxe now.
- Macro language features, most are working and some need improvements.
- Very much a work in progress and still requires much more tests to pass before it can begin taking shots at full Go libraries.
Goals:
- 20 times the amount of Haxe libraries across all Haxe targets.
- Make Haxe much more competitive as a server sided language.
- Clean and fast exucting generated code.
- full acess to the Golangs test suite, thereby transpile the tests and test them in Haxe
- Ease of use following dts2hx’s example.
So you may be asking what does the code generation look like? Something like this:
Most of the remaining work will be in Haxe either by writing parts of Go’s standard library, or tweaking and working on macros,
If that sounds interesting to you I’m very much looking for devs to work with this on, feel free to contact me (here/discord/etc).
P.S
Super big shout out to the Haxe compiler team, this project could not have been possible to make a year ago and am fully indebeted by the amazing strides you guys have taken.
Cheers and to a year of Haxe in 2021