[Up] [Next]
Go up to Escape to Prolog in DCGs and Using Univ
Go forward to Univ

Escape To Prolog

If we want to combine a grammar in the DCG-format with a morphology program written as ordinary Prolog programs, there is a problem. In pseudo-code, we want to say:

verb(Agr,Tense) --> [SurfaceForm]
However, the former is a DCG-rule and the latter is an ordinary Prolog rule. If we just appended the Prolog goal at the end of the lexicon rule, the DCG-interpreter would expand the analyse_verb/4 to analyse_verb/6--not what we need!

The DCG notation provides a way out of this dilemma, by providing one further facility of unlimited power. Any term enclosed in curly brackets is understood by the DCG translator not as a symbol of the grammar, but as a call to a Prolog procedure. This means that when the DCG rule is rewritten into a Prolog predicate, the goal(s) that appear(s) within the curly brackets are not given two extra arguments corresponding to the difference list. Instead, they are simply included just as written at the end of the Prolog rule (you can check how this works by typing listing after the file has been consulted). This is how we would write the rule:

verb(Agr,Tense) --> [SurfaceForm],
This facility is useful not only for morphology. The verb rule above does not include subcategorisation information, but let us add this as well. Now, many verbs verbs occur with two or more different subcategorisation patterns. Give is an example--it can be used in VPs generated by either of the following two rules:
vp -> v, np, np
vp -> v, np, pp
There may well be other types of verbs which can appear in one, but not both of these. For instance, consider consider, as in Tom considers Peter a complete idiot. It can have two np, complements, but not an np and a vp. In order not to have to repeat the rules for different types of verbs, the rules can be written to accept several types of verbs, e.g.:
vp(Agr,Tense) --> v(Agr,Tense,Type), np(_Num), np(_Num),


[Up] [Next]