Send in your ideas. Deadline December 1, 2025
logo
Grant
Theme fund: NGI0 Commons Fund
Start: 2025-10
More projects like this
Software engineering

Support for 64-bit integer expressions in Kaitai Struct

Cross-language code generation for binary parsing

Kaitai Struct (KS) is a tool for working with binary formats. It introduces a declarative domain-specific language for describing the structure of arbitrary binary formats. Based on any specification, KS can automatically generate a ready-to-use parsing module in one of 12 programming languages (C++/STL, C#, Go, Java, JavaScript, Lua, Nim, Perl, PHP, Python, Ruby, Rust). Serialization is supported in Java and Python.

This project aims to improve Kaitai Struct through several enhancements. The main goal is to implement full support for 64-bit integers in expressions across all target languages. Currently, results of integer operations often get truncated to 32 bits in JavaScript and statically typed languages. This also causes incorrect parsing in the popular Kaitai Web IDE and may render it unusable for some formats. Another goal is to improve enum handling. This includes ensuring consistent behavior for unknown enum values across languages like Java, Lua, and Nim, enabling full support for 64-bit integers in enums, and introducing a way to add documentation for whole enums in the .ksy specification that appears as a docstring in the generated code. The project also includes dropping support for Python 2 and integrating modern Python 3 features. This will improve performance and code quality.

Logo NLnet: abstract logo of four people seen from above Logo NGI Zero: letterlogo shaped like a tag

This project was funded through the NGI0 Commons Fund, a fund established by NLnet with financial support from the European Commission's Next Generation Internet programme, under the aegis of DG Communications Networks, Content and Technology under grant agreement No 101135429. Additional funding is made available by the Swiss State Secretariat for Education, Research and Innovation (SERI).