1.5.2 Extending the DCG

Let's see how to use this notation in DCGs. We'll use a small DCG with e.g. 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.

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 phrasal 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.


Aljoscha Burchardt, Alexander Koller and Stephan Walter
Version 1.2.5 (20030212)