Hi everyone,
In 2024, I started learning Haxe and planned to build something with Heaps. I wanted a small narrative scripting language for storytelling, so I needed a parser generator. From working in Go, I was already familiar with two of its main PEG tools, pointlander/peg and pigeon. I ended up adapting pigeon and refactoring its builder to support multiple output languages, starting with Haxe.
I worked on it for about two months. The Haxe target was complete and working. I also ported Go’s unicode package to Haxe as hxUnicode to handle Unicode groups in grammar patterns. My Heaps.io project itself never came together, though. This happens to me quite often: I start building a tool for some project, the project goes nowhere, but the tool gets finished.
Then life and work got busy, and I left the project alone for almost two years. I recently dug it out again and, with some help from AI, added targets for a few other languages I often use, including TypeScript, C#, C99, and Rust.
Since this is the Haxe forum, here is just the Haxe parser generation part:
pegtool -t hx -optimize-parser -o Parser.hx grammar.peg
The generated parser is standalone by default and currently tested with JavaScript and HashLink target.
Any feedback is welcome!
Maybe next time I’ll share some thoughts on narrative scripting languages. I think they shouldn’t have variables or arithmetic syntax of their own and should stay as simple as possible…