DCGs give us a Natural Notation for Features

Adding extra arguments to DCG rules.
But we can do more with DCGs. For a start, we are able to add extra arguments to our DCG rules. And this lets us do some linguistically useful things --- and in particular it lets us use feature s.
Suppose we wanted to deal with sentences like She shoots him, and He shoots her. What should we do? Well, obviously we should add rules saying that he, she, him, and her are pronouns:

pro --> [he].

pro --> [she].

pro --> [him].

pro --> [her].

Furthermore, we should add a rule saying that noun phrases can be pronouns:

np --> pro.

This new DCG (kind of) works. For example:


But there are obvious problems. The DCG will also accept a lot of sentences that are clearly wrong, such as A witch curses she, Her curses a wizard, and Her shoots she.
Here's a bad way of repairing the problem: add more rules. For example, we might rewrite the DCG as follows:

s --> np_subject,vp.

np_subject --> det,n.

np_object  --> det,n.

np_subject --> pro_subject.

np_object  --> pro_object.

vp --> v,np_object.

vp --> v.

det --> [the].

det --> [a].

n --> [witch].

n --> [wizard].

pro_subject --> [he].

pro_subject --> [she].

pro_object --> [him].

pro_object --> [her].

v --> [curses].

This is awful. Basically, we've had to make a big change to the grammar to cope with a very small set of facts. After all, let's face it: I and me are pretty much the same --- they just differ with respect to their case property and the way they sound. By marking information with features, we can do a much neater job:

s --> np(subject),vp.

np(_) --> det,n.

np(X) --> pro(X).

vp --> v,np(object).

vp --> v.

det --> [the].

det --> [a].

n --> [witch].

n --> [wizard].

v --> [curse].

pro(subject) --> [he].

pro(subject) --> [she].

pro(object) --> [him].

pro(object) --> [her].

The extra argument --- the feature --- is simply passed up the tree by ordinary unification. And, depending on whether it can correctly unify or not, this feature controls the facts of English case neatly and simply.
Summing up: features let us get rid of lots of unnecessary rules in a natural way. And DCGs enable us to implement rules with feature information in a natural way.
Above, we said that DCGs are formally more powerful than CFGs. Did the addition of features in our case leave the expressivity of CFGs?

One last remark. Note that extra arguments, really are just plain old Prolog arguments. For example

s --> np(subject),vp.

translates into something like.

s(A,B) :-