re2hare - experimental experiment is experimental

I have been working on a lot of stuff just by myself recently, thinking it should be just a bit more usable before I unleash it unto the world. But for once, I’d like to take some advice from Drew, which is to publish a project as soon as possible, even if it’s not finished, working, or easy to use.

And so, without further excuses, I present to you: re2hare. As the name implies, it is an attempt to add Hare output to the re2c project. The project originally targeted C/C++ (hence the name) and now also supports Rust and Go. In each of these targets, the state machines are implemented by nested loops, using labels to break out of (potentially multiple of) them. Here, Hare’s labeled compound statements were used to achieve the same functionality.

I’ll be honest: this came to be as part of a yak-shaving exercise, and I just thought it might work without spending too much thought on it. The original yak disappeared down the rabbit hole that it came from, so I never got around to actually using it. But it really does seem to work, at least the basics.

I actually have two other use cases that I have considered using this for, but I am not entirely sure either of them will make it past the idea stage. But if anyone does have a good idea for what to do with this, I’d be interested in helping out making it happen!

So, there it is. No documentation, no real-world example code. But it’s out there. If you’re interested, drop a mail in my public inbox, or ping me on IRC, for example in the #hare channel on Libera…