General
Material
Lecture 1
Lecture 2
Lecture 3
Lecture 4
Lecture 5

Querying and tracing a DCG

You can download the DCG that we saw in the lecture here.

Load it and type listing. You will see that Prolog translated the user friendly --> notation to its internal DCG format.

To find out whether a list words L is a sentence, you have to ask the query s(L,[]). But you can also ask whether it is a noun phrase by asking np(L,[]), or whether it starts with a noun phrase by asking np(L,Rest).

Play with the DCG a bit: ask some queries and maybe do a trace.

Back to the practical session of day 4.