Article information
2022 , Volume 27, ¹ 3, p.125-140
Hmelnov A.E.
Algorithms and data structures for automatic generation of binary data reading and printing code from the data format specifications in the language FlexT
The language FlexT (acronym for Flexible Types) is designed for specification of binary data formats. Its main statements are data type definitions that resemble type definitions of imperative programming languages, but are more flexible. For example, the FlexT data types may contain subparts of variable size and may have parameters. The primary purpose of the FlexT interpreter is to display the binary data in accordance with the format specification in a human-readable form. Typically the next step after studying some data format is to write a code for its processing. That’s why we have developed the data reading code generator, which completely automates this task for the substantial part of the data formats described in FlexT. It can generate both the data reading module and the test program. The program demonstrates the correct usage of the module for solving the data visualization task. In the paper we consider the main principles of our approach to code generation, the data structures that we use for representation of information about the generated code and the code generation algorithms.
[full text] [link to elibrary.ru]
Keywords: specifications of binary data formats, declarative language, code generation, data reader, data visualization code
doi: 10.25743/ICT.2022.27.3.010
Author(s): Hmelnov Alexey Evgenievich PhD. , Associate Professor Position: Head of Laboratory Office: Matrosov Institute for System Dynamics and Control Theory of Siberian Branch of Russian Academy of Sciences Address: 664033, Russia, Irkutsk, 134 Lermontov str.
Phone Office: (3952) 45-30-71 E-mail: hmelnov@icc.ru SPIN-code: 8041-3667 References:
1. Hmelnov A.Y., Bychkov I.V., Mikhailov A.A. A declarative language FlexT for analysis and documenting of binary data formats. Proceedings of ISP RAS. 2016; 28(5):239–268. DOI:10.15514/ISPRAS-2016-28(5)-15. (In Russ.)
2. Risso F., Baldi M. NetPDL: an extensible XML-based language for packet header description. Computer Networks. 2006; 50(5):688–706. DOI:10.1016/j.comnet.2005.05.029.
3. Morandi O., Risso F., Baldi M., Baldini A. Enabling flexible packet filtering through dynamic code generation. 2008 IEEE International Conference on Communications. 2008; 5849–5856. DOI:10.1109/ICC.2008.1094. Available at: https://www.semanticscholar.org/paper/Enabling-FlexiblePacket-Filtering-Through-Dynamic-Morandi-Risso/54b6b04c0194e6a7a4c87f64049289ce1a3b09fd.
4. BinPAC. Available at: https://github.com/zeek/binpac (accessed 12/1/2021).
5. Calder B.R., Masetti G. Huddler: a multi-language compiler for automatically generated formatspecific data drivers. U.S. Hydro 2015. Gaylord Hotel, National Harbor, Maryland, USA. Available at: https://www.researchgate.net/publication/277302751_HUDDLER_a_multi-language_compiler_ for_automatically_generated_format-specific_data_drivers.
6. Underwood W. Grammar-based specification and parsing of binary file formats. The International Journal of Digital Curation. 2012; 7(1):95–106. Available at: http://www.ijdc.net/index.php/ijdc/article/viewFile/207/276.
7. Parr T. ANTLR (ANother Tool for Language Recognition). Available at: http://antlr.org (accessed 12/1/2021).
8. Back G. DataScript — A specification and scripting language for binary data. Proceedings of the 1st ACM SIGPLAN/SIGSOFT Conference on Generative Programming and Component Engineering (GPCE’02). London, UK: Springer-Verlag; 2002: 66–77. Available at: http://people.cs.vt.edu/~gback/ papers/gback-datascript-gpce2002.pdf.
9. Back G. DataScript. Available at: http://datascript.sourceforge.net (accessed 12/1/2021).
10. Kaitai Struct. Available at: http://kaitai.io (accessed 12/1/2021).
11. Hmelnov A., Mikhailov A. Generation of code for reading data from the declarative file format specifications written in language FlexT. 2018 Ivannikov Ispras Open Conference (ISPRAS). Moscow; 2018: 23–30. DOI:10.1109/ISPRAS.2018.00011.
12. Bourret R. XML data binding resources. Available at: http://www.rpbourret.com/xml/XMLDataBinding.htm (accessed 12/01/2021).
13. Burns M. The STL format — standard data format for Fabbers. Available at: http://www.fabbers.com/tech/STL_Format (accessed 12/01/2021). Bibliography link: Hmelnov A.E. Algorithms and data structures for automatic generation of binary data reading and printing code from the data format specifications in the language FlexT // Computational technologies. 2022. V. 27. ¹ 3. P. 125-140
|