;; This section of the grammar uses terminals that are composed of
;; octets.

tree_desc := structure labels

;; The octet_string expressed by structure is taken as a root
;; tree_node.  The height of the tree must not exceed 129.  To fit an
;; arbitrary amount of bits into the octet_string, the string must be
;; right-padded as little as possible with 0-bits in order to reach a
;; bitlength divisible by 8.

structure := octet_string

;; The labels sequence assigns a label to each element of the IP
;; address tree described by structure, that was marked as having a
;; label, in depth-first preorder.

labels := label*

;; The octet_string expressed by label is UTF-8-encoded text.

label := octet_string

;; The number of octets must be exactly equal to non_negative_integer.

octet_string := non_negative_integer octet*

;; Expresses a non-negative integer in base 255.  The order is
;; most-significant first.  No leading zero-digits are allowed, even
;; for 0 (so 0 is expressed as just 0xFF).

non_negative_integer := digit* 0xFF
digit := 0x00 | 0x01 | ... | 0xFE ; Expressing 0, 1, ..., 254.

;; This section of the grammar uses terminals that are composed of
;; bits.

tree_node := labelled child child ; Lower child first, then upper child
labelled := 0 | 1 ; 0 if no label, 1 if labelled
child := 0 | 1 tree_node ; 0 if no child at this position, 1 otherwise
