BuProlog

 

BuProlog consists of two JAR files - BuProlog.jar holding a Prolog compiler that generates WAM-like code, and BuWAM.jar, a virtual machine for executing queries against that code.

The system was developed for two reasons. The primary one was to create a smallish compiler and virtual machine suitable for projects in this author's course on compiler design. The second purpose was to make a simple-to-use programming tool for an introductory lab on Prolog. One result of these goals is that the system can print out extensive diagnostic data and, more unusually, generate parse trees and execution graphs showing how queries are evaluated.

The system is easy to use, as shown by the example below where a file containing the append/3 predicate is compiled, and then run inside the BuWAM.

[Using BuProlog]

The -p option included when the BuWAM was called caused the execution tree generated by the user's query to be saved as a graph in queryTree1.png, which is shown below:

[Graph of Query]

This work is a fork of the Java-based Prolog compiler/runtime system written by Stefan Buettcher. However, the compiler was largely rewritten to employ conventional recursive descent parsing and code generation techniques, and the diagnostics and graphing functionality are also new. Buettcher's virtual machine was refactored and simplified in several ways, while retaining enough features to run programs typical of an introductory Prolog lab.

 

Downloads


Dr. Andrew Davison
E-mail: ad@fivedots.coe.psu.ac.th
Back to my home page