next up previous contents
Next: Defining Your Own Up: Another Interlude: Input/Output Previous: The End of

Input of Prolog Terms

Both consult/1 and reconsult/1 have been described in chapter 5.5. Prolog will try to read a clause at a time from the named file. So any error message only refers to the current term being parsed.

Of course, if Prolog cannot find the end properly then we have problems. The Prolog you are using will load all clauses that parse as correct and throw away any ones that do not parse.

Some example problems: the first is where we have typed a `,' instead of a `.'.

 
a:-										a:-

b, b,

c, is read as c,

d:- d:-e.

e.

There are problems with this reading which will be reported by Prolog. Here is another problem caused by typing a `.' for a `,'.

 
a:-										a:-

b. b.

c, is read as c,d:-e.

d:-

e.

This is basically illegal as we are seen to be trying to insert a clause defining ,/2 into the Prolog database.



Paul Brna
Mon May 24 20:14:48 BST 1999