Hatchet — a Haxe 4.x → C++98 transpiler for retro/legacy targets (first release)

Hi everyone,

I’ve been quietly working on a little project and I’d love to finally share it: Hatchet, a transpiler from Haxe 4.x to portable C++98 — the kind of C++ that still compiles under Visual C++ 6.0, so it can target genuinely old platforms like Windows 98 and vintage Unix toolchains.

First, the honest framing: this is not a replacement for hxcpp, and it’s not trying to be. hxcpp is wonderful and far beyond what I could attempt. Hatchet just scratches a very specific itch — hxcpp needs C++11+, which puts modern Haxe out of reach for retro hardware. So I wanted a way to write game/engine code in Haxe on a modern machine, transpile it to plain .h/.cpp, and build that on the old toolchain. It implements a deliberately focused subset of Haxe 4.x and emits hand-writable C++ idioms with no custom runtime — the output is meant to look like code you could have written by hand.

A few things it handles today: classes, interfaces, enums (including parameterized enums with switch destructuring), enum abstract, the common property-accessor patterns, comprehensions, string interpolation, try/catch, and @:native interop for binding existing C++. There’s no GC, so in its place there’s a whole-program ownership analysis that always errs toward leaking over double-freeing. Anything outside the supported subset is reported as a clear diagnostic rather than turning into broken C++ — “fail loudly rather than guess” is the rule I tried hardest to hold to.

It’s early days (v0.1.0) and I’m sure there’s plenty I’ve gotten wrong or missed. I’d be genuinely grateful for any feedback, and I’d completely understand if it turns out this only makes sense for my odd corner of use cases.

Mostly, though, I just want to say thank you. Haxe is a joy to write, and this project simply wouldn’t exist without the language and the community around it. I’ve learned an enormous amount from the manual, the source, and years of forum threads. So thank you all — for the language, and for being so welcoming to people building strange things with it!

Repo (MIT): https://github.com/andrewglind/hatchet

Happy to answer any questions, and thanks for reading,

Andrew

9 Likes