25#ifndef PL_SEARCH_ENGINE_HPP_
26#define PL_SEARCH_ENGINE_HPP_
98 friend class ::EngineTest;
147 return p->apply_choice() &&
call_predicate(p->get_continuation());
Represents a Prolog like cut. When called it pops env_stack thus removing choicepoints.
Definition pred.hpp:235
Represents a disjunction of predicates.
Definition pred.hpp:193
The Engine class manages the execution of predicates and backtracking.
Definition engine.hpp:69
bool call_predicate(PredPtr p)
Call a predicate.
Definition engine.cpp:170
bool unify(TermPtr t1, TermPtr t2)
Unifies two terms.
Definition engine.cpp:76
void clear_stacks()
Clears the environment and trail stacks.
Definition engine.cpp:226
bool execute(PredPtr p, bool unbind)
Executes a predicate.
Definition engine.cpp:241
bool make_choice_and_continue(PredPtr p)
Makes the current choice, checks it, and continues execution (using the predicates continuation) if t...
Definition engine.hpp:146
void trail(PVarPtr v)
Trails a variable.
Definition engine.cpp:49
void pop_pred_call()
Pops the top predicate call from the environment stack.
Definition engine.cpp:204
bool retry_predicate(PredPtr p)
Retries the call on a predicate.
Definition engine.cpp:191
void backtrack()
Performs backtracking.
Definition engine.cpp:59
void push(PredPtr p)
Pushes a predicate onto the environment stack.
Definition engine.cpp:153
Engine()
Definition engine.hpp:71
std::stack< trail_entry * > trail_stack
Stack for trail entries.
Definition engine.hpp:101
std::stack< env_entry * > env_stack
Stack for environment entries.
Definition engine.hpp:102
void cut_to_choice_point(int env_index)
Cuts the environment stack to the choice point at the given index.
Definition engine.cpp:215
Represents the equivalent of Prolog if-then-else i.e. (G1 -> G2; G3) - similar to (G1,...
Definition pred.hpp:305
void wrap_with_once()
Wraps the predicate with a once.
Definition pred.cpp:55
Definition of the CList class.
Definition choice_iterator.hpp:16
std::shared_ptr< Pred > PredPtr
Typedef for a shared pointer to a Pred object.
Definition typedefs.hpp:33
std::shared_ptr< PVar > PVarPtr
Definition typedefs.hpp:44
std::shared_ptr< Term > TermPtr
Typedefs for shared pointers to Terms and subclasses.
Definition typedefs.hpp:43
Definition of the Pred class and its derived classes.
Definition of the PVar class.
Represents an environment entry for predicates.
Definition engine.hpp:57
int trail_index
The index in the trail stack.
Definition engine.hpp:59
PredPtr pred
The predicate being executed.
Definition engine.hpp:58
Represents a trail entry for backtracking.
Definition engine.hpp:49
PVarPtr var
The variable being trailed.
Definition engine.hpp:50
TermPtr value
The value of the variable.
Definition engine.hpp:51
Definition of the Term class.
Definition of common typedefs used in the pl_search library.