Kaitai project is happy to announce release of new major version of Kaitai Struct, declarative markup language to describe various binary data structures — binary file formats, network stream packets, etc.
The basic idea of Kaitai Struct is that a
particular format can be described using
Kaitai Struct language (in a .ksy
file), which then can be compiled
using ksc into source files in
one of the supported programming
languages. These modules will include a
generated code for a parser that can read
described data structure from a file / stream
and provide access to its contents in a nice,
easy-to-comprehend API.
meta/imports can be used to import other types as first-class citizens in current compilation unit; "opaque types" are now disabled by default (see below)terminator, include and consume) can be now used not only for strings, but also for any byte types and user typespad-right to remove declare excess right padding (usually with 0s)parent: expression to enforce a specific parent for an object, or parent: false to disable parenting at all (and, subsequently, remove it from parent type inferring process)_parentdoc-ref to add references to external documentation for types / attributes--opaque-types=true to enable opaque types (disabled by default, i.e. using unknown type would be treated as error)--verbose now allows fine-tuned verbose logging for various compiler's subsystems; using --verbose=all exposes a lot of internal logic.--ksc-json-output to dump compilation results in machine-readable JSON format (simplifies ksc integration in other tools, like visualizers).as<foo>sizeto_ito_s(encoding)to_ireversebytes_to_str in all languagesread_bytes_term (akin to what read_str_term did previously to strings)read_str_* methods, they are to be replaced now with combination of read_bytes_* + bytes_to_strbytes_strip_right and bytes_terminateIO::KaitaiStruct package name (instead of Kaitai)repeat-until handling with substreams