Consider the following TAG in figure 4.21.
As an example of the encoding of such elementary trees in (), consider the encoding of in figure 4.22 and the encoding of in figure 4.23.
Consider what happens if we parse the sentence ``the very pretty girl left today''. The first goal of the parser, is to find a tree of which the root node has category s. In order to find such a goal, a non-chain-rule is selected which has also s as its root node, and of which the string is part of the input string. The rule which is selected is rule . The daughter of this rule is the substitution node np. Therefore, the embedded parse goal is to parse an np, with bag of words [the,very,pretty,girl,today]. Again, the first step of the parser consists in the prediction of a non-chain-rule, of which the root has category np, and of which the string is part of the input bag. This time is selected and we obtain another embedded parse goal: the parsing of a d with bag [the,very,pretty,today]. The non-chain-rule which is selected for this goal is . As this tree does not have any substitution nodes, we can immediately connect to the goal d. As no auxiliary trees apply to , connection is trivial, and we finish the embedded parse goal for d. We thus continue parsing of an np, with head , and of which the substitution nodes are filled in, in the mean time. To connect this tree upward to the np goal, the auxiliary rule may be applied. After the application of that auxiliary tree we obtain the tree:
Again, this tree should be connected upward to the NP goal, with input bag [very,today], and another auxiliary tree can be applied: , giving tree:
Finally, this connects the input tree to the np goal, and this embedded parse is finished. Therefore, we continue the parsing of the s goal, with input bag [today], and of which the head is instantiated as:
The auxiliary rule applies, giving the tree:
which we connect trivially to the goal, as there are no more words left in the input bag.
This example clearly shows how the parser first selects heads, then parses arguments, and finally parses adjunctions.