5.6 Single Sided Unification rules
All Application Manual Name SummaryHelp

  • Documentation
    • Reference manual
      • SWI-Prolog extensions
        • Single Sided Unification rules
          • Single Sided Unification Guards
          • Consequences of => single sided unification rules
          • Single sided unification for Definite Clause Grammars
          • SSU: Future considerations
    • Packages

5.6.3 Single sided unification for Definite Clause Grammars

Single sided unification is attractive for generative DCG rules, i.e., DCG rules that are used to serialize some term. In that context they avoid unwanted matching on variables and provide better error messages in case not all possible terms are described by the grammar. Single sided unification has no practical use for parsing because the arguments are typically output arguments.

If the head of an SSU DCG rules is a term Head, Extra, Extra is interpreted as a push back list if it is a list and as an SSU guard otherwise. The guard is not subject to DCG expansion, i.e., it is interpreted as if enclosed by {}.