News for hackers. Stuff that matters.
Re:Fq: Jq for Binary Formats by mindv0rtex on Sunday June 04, 2023 @08:14PM (#36190816)
The functionality that I am personally interested in from a binary parsing framework like Kaitai is generating an encoder implementation in addition to a decoder one. In other words, given a description of a binary format, I would like to be able to construct an instance of a class whose memory layout matches the format. For instance, if the format has an int n, then an array `a` of size `n`, and then a double `d`, it would be awesome to be able to construct a corresponding object with fields `n`, `a` and `d` and when I change `n`, then the size of `a` changes accordingly. And then, if I pass a pointer to this object to the decoder, it would be able to parse it correctly, as if the memory representation of the object came from some external buffer.
Re:Fq: Jq for Binary Formats by jchw on Sunday June 04, 2023 @10:54PM (#36191721)
Kaitai support for serialization has been a long time issue. It's obviously non-trivial given that it has at least one case that doesn't exist today (instantiating a structure without loading any existing data.)

That said, it does exist in some form.

https://doc.kaitai.io/serialization.html

Restruct supports serialization. I use it all the time to hack on proprietary formats.