DCGs are a special notation provided in most Prolog systems which provide you with a convenient way of defining grammar rules. The general form of each DCG clause is as follows:
Head --> Bodymeaning ``A possible form for Head is Body''.
Bodyare Prolog terms and
`-->'is an infix operator.
The most common use of DCGs is to parse (or generate) some list of symbols according to valid ``rules of grammar'' defined by the DCG clauses. DCGs can be used for purposes other than parsing but for the purposes of this explanation we will stick with the standard parsing application.
Agree to call the symbols (usually words) in the parsed sentence "terminal symbols". Also agree to call symbols which represent higher level language constructs "non-terminal symbols".
[T1,T2,...TN]An empty sequence of terminal symbols is represented by the empty list