Executing Prolog queries

Prolog is used by typing "queries" directly into the Prolog interpreter.

Every time you use Prolog, you will type queries directly into the interpreter. Even when you want to run Prolog programs that you have created using an editor, you will use one of a group of special purpose queries.

One big advantage of an interpreter is that you can experiment with the Prolog language by trying out in-built language features without having first to learn to write programs. The accompanying learning material has many examples for you to try out. The following is one of the early examples.

In this example, the user starts ("invokes") Prolog. Once it is running, the user types the query trace at the Prolog prompt. Notice that the user puts a full-stop after the query before pressing RETURN. Prolog is very fussy about the full-stop.


© P.J.Hancox@bham.ac.uk