4.1.2 Predicate indicators
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Built-in Predicates
        • Notation of Predicate Descriptions
          • Predicate indicators
            • Non-terminal indicators
    • Packages

4.1.2.1 Non-terminal indicators

Compliant to the ISO standard draft on Definite Clause Grammars (see section 4.13), SWI-Prolog also allows for the non-terminal indicator to refer to a DCG grammar rule. The non-terminal indicator is written as [<module>]:<name>//<arity>.

A non-terminal indicator <name>//<arity> is understood to be equivalent to <name>/<arity>+2, regardless of whether or not the referenced predicate is defined or can be used as a grammar rule.51This, however, makes a specific assumption about the implementation of DCG rules, namely that DCG rules are preprocessed into standard Prolog rules taking two additional arguments, the input list and the output list, in accumulator style. This need not be true in all implementations. The //-notation can be used in all places that traditionally allow for a predicate indicator, e.g., the module declaration, spy/1, and dynamic/1.