Генерация кода для разбора спецификаций в декларативном формате языка FlexT (Андрей Михайлов, ISPRASOPEN-2018)
Материал из 0x1.tv
- Андрей Михайлов
The language FlexT (Flexible Types) is intended for specification of binary data formats. The language is declarative and designed to be well understood for human readers. Its main elements are the data type declarations, which look very much like the usual type declarations of the imperative programming languages, but are more flexible. While the primary purpose of the language \FlexT* development was to make the binary data understandable by displaying them according to the format specifications, recently we have implemented the code generator, which can produce data reading code in some imperative languages from the specifications.
The binary data reader should look for the programmer similar to the readers generated by various utilities for XML formats.
By now we have implemented the code generation for the most widely used \FlexT* data types, but some complex types like that used in specifications of machine instructions' encoding are not supported yet. The current capabilities of the code generator are well characterized by that it have successfully produced a full-featured data reader code for the well-known for the GIS community Shape file format. In the article we first give a review of the features of the modern projects oriented to specification of binary file formats and consider their code generation capabilities. Then we briefly review the main features of the \FlexT* language. Finally we describe the main approaches that we use for the code generation. % and consider some examples of the resulting code.
Примечания и ссылки