Contents
Binary format overview
Documentation for the tsk binary formats is generated directly from the code that defines the encoder/decoder, so that the documentation stays in sync.
The binary formats are documented using a description language, which is informally explained here. The intent is to provide enough information for third parties to implement their own encoders and decoders.
Description language grammar
primitive-definition ::= 'prim' <type-name> <name>* 'is' <string>
type-definition ::= 'type' <type-name> <name>* '=' <type>
type-name ::= [A-Z] [A-Za-z0-9]*
name ::= [a-z] [A-Za-z0-9]*
type ::= <type-application> | <type-match>
type-application ::= <type-atom> <type-atom>*
type-atom ::= <type-record> | <type-literal> | '(' <type> ')'
type-record ::= '{' (<type-record-item> (',' <type-record-item>)*)? '}'
type-record-item ::= <name> ':' <type>
type-literal ::= <int> | <string>
int ::= '-'? [0-9]+
string ::= '"' ([^"] | '\' '"')* '"'
type-match ::= 'match' <type> '{' (<type-match-item> (',' <type-match-item>)*)? '}'
type-match-item ::= <type-match-pattern> '=>' <type>
type-match-pattern ::= <type-literal>