Package-level declarations

Types

Link copied to clipboard

The ISO Prolog double_quotes flag, controlling how double-quoted text is parsed.

Link copied to clipboard
data class FlagStore(flags: Map<String, Term>) : Map<String, Term>

An immutable storage for Prolog flags and their values, i.e. the String → Termmap a [it.unibo.tuprolog.solve.Solver] reads (via [it.unibo.tuprolog.solve.ExecutionContextAware.flags]) to answer current_prolog_flag/2` and similar. Keeping flags as data, rather than as scattered solver fields, makes the whole configurable surface of a solver enumerable and snapshot-able as part of an it.unibo.tuprolog.solve.ExecutionContext.

Link copied to clipboard

An implementation-specific flag controlling whether the solver performs last-call (tail-call) optimization, i.e. avoids growing its internal execution-context stack on genuine tail calls. Defaults to ON.

Link copied to clipboard

The ISO Prolog max_arity flag, reporting the maximum arity a it.unibo.tuprolog.solve.Signature may have. Not isEditable: 2P-Kt reports Int.MAX_VALUE as its only admissible value, i.e. no practical limit is enforced.

Link copied to clipboard
interface NotableFlag

A typed, well-known Prolog flag, i.e. a named switch whose legal values and default are known ahead of time -- as opposed to the arbitrary String → Termentries a plain [FlagStore] can also hold. Implemented as object`s for both ISO-standard flags (Unknown, DoubleQuotes) and implementation-specific ones (LastCallOptimization, TrackVariables, MaxArity).

Link copied to clipboard

An implementation-specific flag controlling whether the solver keeps track of variable names/bindings beyond what is strictly needed to compute a it.unibo.tuprolog.solve.Solution (e.g. for richer debugging/inspection). Defaults to OFF.

Link copied to clipboard

The ISO Prolog unknown flag, controlling what happens when a goal's predicate does not exist in the current knowledge base/libraries at all: raise an it.unibo.tuprolog.solve.exception.error.ExistenceError (ERROR, the default), just report a it.unibo.tuprolog.solve.exception.warning.MissingPredicate warning (WARNING), or silently fail the goal (FAIL).

Functions

Link copied to clipboard
fun <T : NotableFlag> flag(notableFlag: T, f: T.() -> Term): Pair<String, Term>

Pairs notableFlag's NotableFlag.name with the Term computed by f, applied to notableFlag itself.

Link copied to clipboard
operator fun <T : NotableFlag> T.invoke(f: T.() -> Term): Pair<String, Term>

Operator shorthand for flag: myFlag { someValue }.