My implementation of Prolog in Java is interpreter-based; hopefully it can be generically interfaced with Java. Towards the latter goal, I have hacked together two applets: Botworld and GLog. There's also some code to support the applets in the MIS document.

The plan is to implement a JIT for it; in other words, to dynamically build and execute Java classes from the source predicates, based on information (e.g. mode and type information) collected at run time. I guess this is an attempt to show that the complexity associated with static source analysis can be avoided. My supervisor is Andrew Taylor at CSE, UNSW.

The source is available: prolog.tar.gz. Be aware that it is a work in progress and is therefore likely to undergo radical (unannounced) change. Please scan the source files for clues as to what makes the parser happy, limitations, what to do with pre-compiled predicates, etc. Any and all feedback is welcomed.

Please note that the compiler is almost completely broken - as is usual with thesis projects, a prototype that runs a few examples is the most that can be hoped for.


To Do

What you get:

I have included gnu.getopt and a hacked version of gnu.math (from kawa, renamed as prolog.math).

There' a jarball of BCEL included, but you'll need to make sure the de and gnu directories are accessible CLASSPATH-wise.

The startup script (run) will need to be hacked so that the CLASSPATH variable is set appropriately. If you want to rebuild from the source, the GNUMakefile supplied does the job if you have GNU make.

Legal mumblings

This is released under the LGPL. Be kind to it.
    Prolog Interpreter and JIT Compiler.
    Copyright (C) 2000 Peter Gammie (

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

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Peter Gammie
Last modified: Mon May 10 15:03:37 CEST 2004