+functions produce an abstract syntax tree (AST) describing the input
+lines in a regular form. It may be reviewed at any time with
+.Fn mdoc_nodes ;
+however, if called before
+.Fn mdoc_endparse ,
+or after
+.Fn mdoc_endparse
+or
+.Fn mdoc_parseln
+fail, it may be incomplete.
+.\" PARAGRAPH
+.Pp
+The AST is composed of
+.Vt struct mdoc_node
+nodes with block, head, body, element, root and text types as declared
+by the
+.Va type
+field. Each node also provides its parse point (the
+.Va line ,
+.Va sec ,
+and
+.Va pos
+fields), its position in the tree (the
+.Va parent ,
+.Va child ,
+.Va next
+and
+.Va prev
+fields) and type-specific data (the
+.Va data
+field).
+.\" PARAGRAPH
+.Pp
+The tree itself is arranged according to the following normal form,
+where capitalised non-terminals represent nodes.
+.Pp
+.Bl -tag -width "ELEMENTXX" -compact -offset "XXXX"
+.\" LIST-ITEM
+.It ROOT
+\(<- mnode+
+.It mnode
+\(<- BLOCK | ELEMENT | TEXT
+.It BLOCK
+\(<- (HEAD [TEXT])+ [BODY [TEXT]] [TAIL [TEXT]]
+.It BLOCK
+\(<- BODY [TEXT] [TAIL [TEXT]]
+.It ELEMENT
+\(<- TEXT*
+.It HEAD
+\(<- mnode+
+.It BODY
+\(<- mnode+
+.It TAIL
+\(<- mnode+
+.It TEXT
+\(<- [[:alpha:]]*
+.El
+.\" PARAGRAPH
+.Pp
+Of note are the TEXT nodes following the HEAD, BODY and TAIL nodes of
+the BLOCK production. These refer to punctuation marks. Furthermore,
+although a TEXT node will generally have a non-zero-length string, in
+the specific case of
+.Sq \&.Bd \-literal ,
+an empty line will produce a zero-length string.
+.\" PARAGRAPH
+.Pp
+The rule-of-thumb for mapping node types to macros follows. In-line
+elements, such as
+.Sq \&.Em foo ,
+are classified as ELEMENT nodes, which can only contain text.
+Multi-line elements, such as
+.Sq \&.Sh ,
+are BLOCK elements, where the HEAD constitutes line contents and the
+BODY constitutes subsequent lines. In-line elements with matching
+pairs, such as
+.Sq \&.So
+and
+.Sq \&.Sc ,
+are BLOCK elements with no HEAD tag. The only exception to this is
+.Sq \&.Eo
+and
+.Sq \&.Ec ,
+which has a HEAD and TAIL node corresponding to the enclosure string.
+TEXT nodes, obviously, constitute text, and the ROOT node is the
+document's root.
+.\" SECTION