## 13.4.2 Cardinals and bit vectors

 Page 442 of 800 Search internet

 bit ::= 0 | 1 byte ::= bit*8 bytes ::= byte* septet ::= bit*7 middle-septet ::= 1 septet end-septet ::= 0 septet cardinal ::= middle-septet* end-septet vector ::= length bytes length ::= cardinal

A byte denotes a value in 0..255. As an example, mixed endian 0000 0010 denotes 2.

A middle or end septet denotes a value in 0..127. As examples, the middle septet 1000 0010 and the end septet 0000 0010 both denote 2.

In this context, a 'Cardinal' is a non-negative integer. Cardinals are expressed little endian base 128. As an example,

1000 0011 0000 0010

denotes 3+128*2 = 3+256 = 259.

A 'vector' encodes a sequence of bits. The 'length' field of the vector indicates the number of bits in the vector. The 'bytes' field of the vector contains the actual bits, padded with zero to seven bits to make the length of the the 'bytes' field divisible by eight. As an example, consider the vector

<1,1,0,0, 0,0,0,0,  1,1,0,0, 0,1,0,0>

In mixed endian binary (each byte written in 'reverse' order with the MSB first and LSB last), the vector reads:

0000 0011  0010 0011

The vector above encode the three-bit sequence <1,1,0>. The length field contains binary 3. This is easiest to see in the mixed endian notation. The bytes field contains the three bits <1,1,0> followed by garbage. This is easiest to see in the bit-vector notation.

The grammar of messages is *not* context free because the 'vector' syntax class cannot be expressed in a context free manner.

 Page 442 of 800 Search logiweb.eu