This is pretty cool. Reminds me of Erlang’s pattern matching and how easy it is to parse binary data with it.
The fact that there are compilers for several different programming languages makes it feel like protobuf, except on any arbitrary binary data!
If folks are interested in binary parsing, the canonical repo is https://github.com/dloss/binary-parsing
Don’t underestimate https://docs.python.org/3/library/struct.html
The perl/python struct modules were my original inspiration 20 years ago for what is lately https://github.com/c-blake/nio
No C support?
I like Kaitai, it’s similar to poke and other tools. One thing however that is missing from kaitai is the ability to generate a formatted binary, at the moment it’s only a parser.
I wrote a similar library in Rust, but includes the reverse of parsing, writing: Deku: Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization -> https://github.com/sharksforarms/deku