A drawback of CFGs is that the number of rules grows exponentially when agreement in sentences needs to be taken into account. Figure 2.4 demonstrates how the number of rules doubles as a single dependency (subject and verb number agreement) is added to the grammar.
Definite Clause Grammars (DCGs) overcome this problem by allowing first-order terms as nonterminals. Each dependency is then added as an extra argument to each first-order term.
Figure 2.5 shows a similar version of the grammar in Figure 2.2 except it is now in DCG format with the agreement between the number of the noun and the number of the verb added as a parameter to each rule.
This example DCG allows the sentence ``bob flies'' but not the sentence ``bob fly'' and no extra grammar rules were needed to be added to ensure this.
The power of DCGs compared to that of CFGs should be apparent, but it should be noted, however, that in order to retain the properties that CFGs held, it is necessary to restrict the number of values each DCG argument may take. If this is not done, if the DCG is rewritten as a CFG (as it is always possible to do) it would be possible to write infinitely many rules, and thus not conform to the definition of a CFG (a finite set of derivation rules within the four-tuple).
One disadvantage of the DCG approach is that to extend a grammar each rule must be changed because of the fixed arity of each predicate, and an extension of the DCG approach is to have a single argument to each predicate that is a list of the DCG arguments. With this now fixed arity, only the necessary rules need be extended with an extra argument added to their list.