tsk

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.

Binary format description grammar

<primitive-definition> ::= 'primitive' <type-name> <name> 'is' <primitive-description>
<primitive-description> ::= <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>