Definite Clause Grammars (expansion)

Author(s): Daniel Cabeza.

This module implements the translation for Definite Clause Grammars (DCGs) (expansion).

Usage and interface

Documentation on exports


Like phrase(Phrase,List,[]).
Meta-predicate with arguments: phrase(goal,?).


Meta-predicate with arguments: phrase(goal,?,?).

Usage: phrase(Phrase,List,Remainder)

  • Description: The list List is a phrase of type Phrase (according to the current grammar rules), where Phrase is either a non-terminal or more generally a grammar rule body. Remainder is what remains of the list after a phrase has been found.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Phrase is currently a term which is not a free variable.
  • The following properties should hold globally:
    (doc_props:doc_incomplete/1)Documentation is still incomplete: phrase(Phrase,List,Remainder) may not conform the functionality documented.

Performs the code expansion of source clauses that use DCGs.

Known bugs and planned improvements

  • Run-time checks have been reported not to work with this code. That means that either the assertions here, or the code that implements the run-time checks are erroneous.