|Did you know ...||Search Documentation:|
|Pack prolog_library_collection -- prolog/dcg.pl|
Typically, grammar A specifies how words can be formed out of characters. A character is a code, and a word is a list of codes. Grammar B specifies how sentences can be built out of words. Now the word is an atom, and the sentences in a list of atoms.
This means that at some point, words in grammar A, i.e. lists of codes, need to be translated to words in grammar B, i.e. atoms.
This is where dcg_atom//2 comes in. We illustrate this with a schematic example:
sentence([W1,...,Wn]) --> word2(W1), ..., word2(Wn). word2(W) --> dcg_atom(word1, W). word1([C1, ..., Cn]) --> char(C1), ..., char(Cn).
The following predicates are exported, but not or incorrectly documented.