AI-Prolog
view release on metacpan or search on metacpan
lib/AI/Prolog/Engine.pm view on Meta::CPAN
package AI::Prolog::Engine;
$REVISION = '$Id: Engine.pm,v 1.13 2005/08/06 23:28:40 ovid Exp $';
$VERSION = '0.4';
use strict;
use warnings;
use Carp qw( confess carp );
use Scalar::Util qw/looks_like_number/;
use Hash::Util 'lock_keys';
use aliased 'AI::Prolog::Term';
use aliased 'AI::Prolog::Term::Cut';
use aliased 'AI::Prolog::Term::Number';
use aliased 'AI::Prolog::TermList';
use aliased 'AI::Prolog::TermList::Step';
use aliased 'AI::Prolog::TermList::Primitive';
use aliased 'AI::Prolog::KnowledgeBase';
use aliased 'AI::Prolog::Parser';
use aliased 'AI::Prolog::ChoicePoint';
use AI::Prolog::Engine::Primitives;
use constant OnceMark => 'OnceMark';
# The engine is what executes prolog queries.
# Author emeritus: Dr. Michael Winikoff
# Translation to Perl: Curtis "Ovid" Poe
# $prog An initial program - this will be extended
# $term The query to be executed
# This governs whether tracing is done
sub trace {
my $self = shift;
if (@_) {
$self->{_trace} = shift;
return $self;
}
return $self->{_trace};
}
sub halt {
my $self = shift;
if (@_) {
$self->{_halt} = shift;
return $self;
}
return $self->{_halt};
}
my $FORMATTED = 1;
sub formatted {
my $self = shift;
if (@_) {
$FORMATTED = shift;
return $self;
}
return $FORMATTED;
}
my $RAW_RESULTS;
sub raw_results {
my $self = shift;
if (@_) {
$RAW_RESULTS = shift;
if ($RAW_RESULTS) {
( run in 0.420 second using v1.01-cache-2.11-cpan-5b529ec07f3 )