10.5.2 Extending the DCG

To use the resulting DCG for semantic construction, we have to specify the semantic representation for each phrasal and lexical item.

Let's see how to use this notation in DCGs. We'll use an extended version of our well-known dCGExample.pl from Chapter 5. To make things a bit more interesting, we've added an intransitive verb and a proper name as well as the necessary rules to use them in sentences. To use the resulting DCG for semantic construction, we have to specify the semantic representation for each phrasal and lexical item. We do this by giving additional arguments to the phrase markers of the DCG (a technique that we already know from Chapter 5).

The resulting grammar is found in semanticDCG.pl . Let's have a look at the phrasal rules first:

s(NP@VP) --> np(NP),vp(VP).

np(DET@N) --> det(DET),n(N).
np(PN) --> pn(PN).

vp(TV@NP) --> tv(TV),np(NP).
vp(IV) --> iv(IV).

The unary phrasal rules just percolate up their semantic representation (here coded as Prolog variables NP, VP and so on), while the binary prasal rules use @ to build a semantic representation out of their component representations. This is completely transparent: we simply apply function to argument to get the desired result.


Kristina Striegnitz, Patrick Blackburn, Katrin Erk, Stephan Walter, Aljoscha Burchardt and Dimitra Tsovaltzi
Version 1.2.5 (20030212)