com.svincent.moksa
Class PrologEngine

java.lang.Object
  |
  +--com.svincent.moksa.WamObject
        |
        +--com.svincent.moksa.PrologEngine

public class PrologEngine
extends WamObject

Global context for everything, plus a public interface for users.


Inner Class Summary
 class PrologEngine.AddHandler
           
static class PrologEngine.ArithmeticHandler
           
 class PrologEngine.NegateHandler
           
 class PrologEngine.SubtractHandler
           
 
Field Summary
 boolean debug
           
 boolean debugUnify
           
 boolean trace
          Debug flags inlined for speed and comfort.
 
Constructor Summary
PrologEngine()
          Make a new PrologEngine.
 
Method Summary
 void addArithmeticHandler(PrologEngine.ArithmeticHandler ah)
           
 void asserta(PrologTerm term)
          Asserts a new clause before all clauses of the definition of the given predicate.
 void asserta(Rule rule)
          Asserts a new clause before all clauses of the definition of the given predicate.
 void assertz(PrologTerm term)
          Asserts a new clause after all clauses of the definition of the given predicate.
 void assertz(Rule rule)
          Asserts a new clause after all clauses of the definition of the given predicate.
 Rule compileRule(PrologTerm term)
           
 PrologFactory getFactory()
          Retrieve the new object Factory used in this PrologEngine.
 void installArithmeticHandlers()
           
 void installBuiltins()
          Install all the builtin rules.
 boolean invoke(CompoundTerm goal)
          Utility method from outside.
 void loadModule(java.lang.String moduleName)
           
 IndentPrintWriter log()
          Retrieve the current output log.
 PrologEngine.ArithmeticHandler lookupArithmeticHandler(java.lang.String name)
           
 Variable[] solve(CompoundTerm goal)
          Utility method from outside.
 
Methods inherited from class com.svincent.moksa.WamObject
tag, tag
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trace

public boolean trace
Debug flags inlined for speed and comfort.

debug

public boolean debug

debugUnify

public boolean debugUnify
Constructor Detail

PrologEngine

public PrologEngine()
Make a new PrologEngine.
Method Detail

getFactory

public PrologFactory getFactory()
Retrieve the new object Factory used in this PrologEngine.

log

public IndentPrintWriter log()
Retrieve the current output log.

asserta

public void asserta(PrologTerm term)
             throws PrologException
Asserts a new clause before all clauses of the definition of the given predicate.

assertz

public void assertz(PrologTerm term)
             throws PrologException
Asserts a new clause after all clauses of the definition of the given predicate.

asserta

public void asserta(Rule rule)
Asserts a new clause before all clauses of the definition of the given predicate.

assertz

public void assertz(Rule rule)
Asserts a new clause after all clauses of the definition of the given predicate.

solve

public Variable[] solve(CompoundTerm goal)
                 throws PrologException
Utility method from outside. solves 'goal':

invoke

public boolean invoke(CompoundTerm goal)
               throws PrologException
Utility method from outside. solves 'goal':

installBuiltins

public void installBuiltins()

Install all the builtin rules.

There are big issues with this, particularly w.r.t. memory consumption. Rather, I should load things dynamically (maybe have a lookup table of modules that can be loaded by function name or something...)

XXX when we do modules, there can be a dynamic module called 'java', which allows builtin classes to be dynamically loaded. Much nicer.


installArithmeticHandlers

public void installArithmeticHandlers()

addArithmeticHandler

public void addArithmeticHandler(PrologEngine.ArithmeticHandler ah)

lookupArithmeticHandler

public PrologEngine.ArithmeticHandler lookupArithmeticHandler(java.lang.String name)

compileRule

public Rule compileRule(PrologTerm term)
                 throws PrologException

loadModule

public void loadModule(java.lang.String moduleName)
                throws PrologException



This is documentation for Moksa Prolog, which can be found at http://www.svincent.com/moksa/

Copyright © 1999 Shawn P. Vincent.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.