|
| class | ChoicePred |
| | A base class that represents a choice predicate. More...
|
| |
| class | CList |
| | Represents a list of terms. More...
|
| |
| class | DisjPred |
| | Represents a disjunction of predicates. More...
|
| |
| class | FailPred |
| | Represents a failure predicate that always fails when called. More...
|
| |
| class | IfThenElse |
| | Represents the equivalent of Prolog if-then-else i.e. (G1 -> G2; G3) - similar to (G1, !, G2; G3) More...
|
| |
| class | Loop |
| | Represents a loop predicate that iterates over instances of a predicate. More...
|
| |
| class | LoopBodyFactory |
| | LoopBodyFactory is an abstract base class used for generating instances of a predicate class used in the body of a loop. See the Loop class for details of how this is used. More...
|
| |
| class | NotNot |
| | Represents an equivalent of the Prolog call \+\+Pred. The aim is to determine if Pred succeeds without binding any variables in the call. More...
|
| |
| class | Once |
| | Represents the equivalent of Prolog's once(Pred). The aim is to remove any choicepoints produced by Pred. More...
|
| |
| class | PAtom |
| | Represents a Prolog atom. More...
|
| |
| class | PFloat |
| | Represents a Prolog float. More...
|
| |
| class | PInt |
| | Represents a Prolog integer. More...
|
| |
| class | Pred |
| | Base class for Prolog-like predicates. More...
|
| |
| class | PVar |
| | Represents a Prolog variable. More...
|
| |
| class | Term |
| | Abstract base class for terms that approximate Prolog terms. More...
|
| |
| class | Trail |
| | The Trail class is used to manage variable bindings during the execution of Prolog-like predicates. More...
|
| |
| struct | trail_entry |
| |
| class | UpdatablePVar |
| | UpdatableVar implements what some Prologs call updatable assignment. More...
|
| |
| class | VarChoicePred |
| | Represents a choice predicate that makes choices for a variable from a set of terms. More...
|
| |
|
| PredPtr | conjunction (std::vector< PredPtr > preds) |
| | Represents a conjunction of predicates by chaining them together via continuations. The continuations of each predicate is modified to point to the next predicate in the conjunction. The continuation of the last predicate in the conjunction is not modified.
|
| |
| std::string | repr (PredPtr pred) |
| |
| bool | unify (TermPtr t1, TermPtr t2, Trail *trail) |
| | Unifies two terms, binding variables as necessary.
|
| |
| bool | operator== (Term &t1, Term &t2) |
| | == test for TermPtrs
|
| |
| bool | operator< (Term &t1, Term &t2) |
| | < operator for Terms. Approximates the < operator in Prolog. The ordering is as follows: pvar < pint, pfloat < patom < clist < user-defined classes "older" vars are less than "newer" vars patoms are ordered by name pints and pfloats are ordered by value clists are ordered by the first element, then the second, etc.
|
| |
| bool | operator<= (Term &t1, Term &t2) |
| | <= operator for Terms
|
| |
Unifies two terms, binding variables as necessary.
Unifies two terms.
- Parameters
-
| t1 | The first term. |
| t2 | The second term. |
| trail | Pointer to the Trail for managing variable bindings. |
- Returns
- True if the terms unify, false otherwise.
This function implements the unification algorithm for Prolog-like terms. It handles variable dereferencing, variable binding, and unification of user-defined classes. When unifying a variable with a term, the variable is trailed before bind is called to ensure that the variable can be reset when backtracking occurs. When backtracking occurs , the trail is used to reset any variables that were bound after the call in which unify was called.
- Parameters
-
| t1 | The first term. |
| t2 | The second term. |
| trail | The trail for backtracking. |
- Returns
- True if the terms unify, false otherwise.