01: package ca.draisey.free.tprolog;
02:
03:
04:
05:
06:
07:
08:
09:
10:
11:
12:
13:
14:
15:
16:
17:
18: abstract class Term extends Clause {
19:
20: final Term dequantifyTerm() { return this; }
21:
22:
23: final void queryClause( final Term goal, final Variables these, final Variables goals, final Successor success )
24: {
25: unifythrough( goal, these, goals, success );
26: }
27:
28:
29:
30:
31:
32:
33: protected abstract void unifythrough( final Term that, final Variables these, final Variables those, final Successor success );
34:
35:
36:
37: protected void unifytoPair( final PairTerm that, final Variables these, final Variables those, final Successor success ) {};
38: protected void unifytoCons( final ConsTerm that, final Variables these, final Variables those, final Successor success ) {};
39: protected void unifytoAtom( final AtomTerm that, final Variables these, final Variables those, final Successor success ) {};
40:
41: protected void unifytoUnboundVariable( final VariTerm that, final Variables these, final Variables those, final Successor success )
42: {
43: that.bindto( this, those, these, success );
44: }
45: }
46:
47:
Prolog in Java
A trivial prolog interpreter written in java.
Copyright 2004, M.E.J.Draisey
This file is part of tprologinjava.
tprologinjava 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.
tprologinjava is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with tprologinjava; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Formatted with
GNU source-highlight:
http:// www.gnu.org/ software/ src-highlite