Skip to content

Type description

Mikhail Yakshin edited this page Feb 24, 2016 · 3 revisions

Type descriptions takes central place in every .ksy file. Top-level map is a type description with additional meta key. Also, type descriptions might be included deeper, namely, in types section, to create nested structures.

For most programming languages, "types" are directly mapped to classes which will perform the parsing of incoming binary stream.

Type description is a map of strings (keys) to various values.

seq

  • Contents: a sequence of attribute descriptions
  • Purpose: identifier for a primary structure described in top-level map
  • Influences: would be translated into parsing method in a target class
  • Mandatory: no

types

  • Contents: map of strings to type description
  • Purpose: create types for sub-structures that could be referenced in attribute descriptions in any seq element
  • Influences: would be translated into distinct classes (usually nested into main one, if target language allows it)
  • Mandatory: no

instances

  • Contents: map of strings to instance description
  • Purpose: description of data that lies outside of normal sequential parsing flow (for example, that requires seeking somewhere in the file) or just needs to be loaded only by special request
  • Influences: would be translated into distinct methods (that read desired data on demand) in current class
  • Mandatory: no
Clone this wiki locally