Public domain input and output routine for standard Prolog.
===========================================================

Koen De Bosschere, March 15, 1994.
Laboratory for Electronics and Information Systems
University of Ghent, Belgium
kdb@elis.rug.ac.be

This directory contains the following files:

README              This file
Makefile            To create 'parse'
sample.pl           Sample Prolog text

interf.c            Interface to the underlying system
interf.h

interf.c.binprolog  Sample interface to the binprolog system
interf.h.binprolog

operator.c          Toy operator table

symtab.h            Toy symbol table
symtab.c

token.c             Lexer
token.h

rterm.c             Parser (Prolog read)

wterm.c             Display (Prolog write)

parse.c             Sample test program


After untaring, the command

   make

will return

        cc -O -w -c wterm.c
        cc -O -w -c rterm.c
        cc -O -w -c token.c
        cc -O -w -c parse.c
        cc -O -w -c operator.c
        cc -O -w -c symtab.c
        cc -O -w -c interf.c
        cc -O -w -o parse wterm.o rterm.o token.o parse.o operator.o symtab.o interf.o

and will create the file

   parse

This file can then be executed. The program waits for input
of a Prolog read term, and displays it immediately.

E.g.,

   parse <return>
   test.  <return>
   test.  % returned by the program
   test(1, 2).  <return>
   test(1,2). % returned by the program
   test (1,2).  <return>
   syntax_error on line 3: Incomplete reduction
   
   =====================
   |    0:  1000  term   1,2
   |    0:  1000  term   test
   =====================


and the program exits. Before exiting, it displays
the contents of the parse stack. In this case,
(1,2) has been interpreted as a bracketed expression
(= term). A term followed by another term causes
an error.

The parser can be tested on the sample prolog program.
by executing

   make test

The final command

   diff sample.out2 sample.out3

should give no differences (sample.out and sample.out2
have still some different variable names).

The command

   make clean

cleans up the files that have been created.

=========================================================

In order to port this package to a Prolog system,

the system independent files

   token.c             Lexer
   token.h
   rterm.c             Parser (Prolog read)
   wterm.c             Display (Prolog write)

should be taken without changes. The system
dependent files are:
 
  interf.h
  interf.c

They should be changed such that they provide
the right interface to the Prolog system. As an
example, a non-toy and working pair of interface
files for the BinProlog system are added.

===========================================================

This software may be used free of charge by anyone.
However, if you decide to use it, if you find errors, 
or modify/improve it, we would be glad to know it.


-- Koen De Bosschere
   kdb@elis.rug.ac.be
   March 15, 1994.
