Linguistics 482 - Computational Linguistics Prolog Notes A. C. Brett
Department of Linguistics
University of Victoria
Clearihue C139
Last updated: 9 October 2005

Consulting a Prolog Program

The procedure for making a Prolog program available to the Listener is called consulting. To consult a program that you have already written, do the following:
  1. Click on the word "Listener" at the top of the Amzi! Development Environment window (or, while depressing the [Alt] key, press the letter "l" key).
  2. Click on the Consult... option in the menu that opens (or, use the down arrow key to move to the Consult... option, and then press [Return] or [Enter]).
  3. In the Open window that appears, pick the drive on which the file containing your Prolog program is stored. (At the bottom of the window, toward the right, under "Drives:", click on the downward-pointing arrowhead, and then click on the appropriate drive identifier in the list that appears. Since your program files will normally be stored on diskette, pick the "a:" drive.)
  4. If necessary, pick the directory in which you have stored your program file (in the "Folders:" panel immediately above "Drives:").
  5. In the list of files in the "File name:" panel, immediately to the left of the "Folders:" panel, click on the name of the file containing the Prolog program you want to make available to the Listener.
  6. Then click the "OK" button in the upper right-hand corner of the window.
You can also consult your program using the consult/1 system predicate. For example, if your program is stored on diskette in a file with the name "", you can consult the program by typing
at the "?-" prompt.

Note that, since the DOS name of the file containing your program includes the ":" and "." characters, the argument of the consult/1 predicate must be enclosed in apostrophes. Remember to type the period that ends all Prolog clauses.

If there are no syntax errors in your program, the Listener will respond "yes" and display the "?-" prompt. You can then type a query (or claim).

If there is a syntax error in your program, the Listener will respond "no", and display an error message. The text of the message might be sufficient for you to identify the error. For more information about the Listener error messages, click on the Error Messages item in the IDE help window.

Linguistics 482 Prolog Introductory Notes Top of Page