And this paper https://dl.acm.org/doi/10.1145/1863523.1863525 "Invertible syntax descriptions: unifying parsing and pretty printing"
And this Haskell library https://hackage.haskell.org/package/roundtrip among others
I really wish though that there were more traction here, as I really believe that we should be quite prepared do deal with bits and not protobufs by default. nothing wrong with protobufs for quite a number of uses. I just don't know why people are so afraid of and/or biased against bit strings.
Are we not talking about writing binary files that conform to the spec?
Like, in the case of a GIF: simply writing valid garbage data should produce a file that presents as a valid GIF with noise for the image. Similarly: reading the file through the parser and writing it out unmodified should create an identical file (assuming no stenography).
Right?
There are already similarly declarative tools which can accomplish this. Haskell has binary parsing libraries which work similarly and give you both reading and writing capabilities.
It's a declarative bit-level symmetrical reader writer generator library.
ASN.1 does more or less what I was hoping Kaitai can do. Where's the breakthrough?
I just want to be able to describe network protocols in some "language" and generate code that can serialize/deserialize it.
Any chances you have some reference to what you saw?
I understand what you're saying though. Memories of using this were... unpleasant. I think the 'best' alternative for me would be RecordFlux. Ada-like syntax, generation of AoRTE-provable SPARK code, and recently the expressivity of the tool has increased. And the whole thing is in python, easily extensible to build things from the type description: generators, fuzzers, advanced specific parsers (need only one field and want the control fields' positions and sizes), wireshark plugins, Postgres extensions...
I really like what they're doing there. Might be the one of the low-effort (for the user!) lead-bullets for safer software.
https://construct.readthedocs.io/en/latest/intro.html#exampl...
I’ve long searched for something better than Construct, but so far I have yet to find even an equal.
[1] https://github.com/wpietri/simpleais [2] https://gpsd.gitlab.io/gpsd/AIVDM.html
100% fix formats with no self reference or for example checksums that sits in front of the checksumd data (no streaming possible)...
>Kaitai: Describe the structure of data, not how you read or write it
I started working on an alternative that supported writing but didn't follow through since I didn't think many people were interested in Kaitai to begin with.
> Reading and writing binary formats is hard... Kaitai Struct tries to make this job easier...
Kaitai cannot write data back out. [1] This is a major limitation for me. It would be nice to use it as a mutation engine for fuzzing, but without being able to write it back out, it is mostly just beneficial for analysis.
1. https://doc.kaitai.io/faq.html#writing