DirectiveListener

A ClauseListener refinement that further dispatches Directives (:- Goal clauses) depending on which of patterns their body unifies with, rather than treating every directive alike via ClauseListener.onDirective.

See also

for the concrete set of ISO/implementation-defined directive patterns 2P-Kt recognizes.

Inheritors

Properties

Link copied to clipboard
abstract val patterns: List<Term>

The directive-body patterns recognized by this listener, tried in order.

Link copied to clipboard
abstract val unificator: Unificator

The Unificator used to match a directive's body against patterns.

Functions

Link copied to clipboard
open override fun listen(clause: Clause)

Dispatches clause to onDirective/onFact/onRule/onClause, depending on its concrete kind.

Link copied to clipboard
open fun listenDirective(directive: Directive)

Tries to unify directive's body against each of patterns, in order; on the first match, delegates to listenDirectiveMatchingPattern, otherwise falls back to ClauseListener.onDirective.

Link copied to clipboard
open fun listenDirectiveMatchingPattern(directive: Directive, pattern: Term, unifier: Substitution.Unifier)

Invoked by listenDirective on a match; by default just forwards to onDirectiveMatchingPattern.

Link copied to clipboard
abstract fun onClause(clause: Clause)

Invoked when listening any Clause that is neither a Directive, Fact, nor Rule.

Link copied to clipboard
abstract fun onDirective(directive: Directive)

Invoked when listening a Directive (a :- Goal clause).

Link copied to clipboard
abstract fun onDirectiveMatchingPattern(directive: Directive, pattern: Term, unifier: Substitution.Unifier)

Invoked when a directive's body unifies with one of patterns, via unifier.

Link copied to clipboard
abstract fun onFact(fact: Fact)

Invoked when listening a Fact (a clause with an empty body).

Link copied to clipboard
abstract fun onRule(rule: Rule)

Invoked when listening a Rule (a clause with a non-empty body, other than a Directive).