2.2 The Prolog development cycle

Two states

When using Prolog, the system is fundamentally in one of two states:

  1. Either the state where you can write programs and questions, or
  2. the state where you are executing a query

In the latter state, you have no control over what is happening (although you can stop the process by pressing the stop-button). In this state, Prolog is answering the question you have typed beforehand. When Prolog has finished finding all solutions, it returns you to the state where you can edit your program and write a question.

The programming cycle

This can be represented as in the following cycle:

  1. Write program
  2. Compile
  3. Ask question
  4. Get answer
  5. Restart cycle.

The second stage, compiling the program, is a process whereby the Prolog+CG environment translates your program into object code, which is a form that can be more readily executed by the Prolog+CG engine than the bare text of your program.

Summary

The Prolog+CG environment is fundamentally in one of two states. In the first state, you can write programs and questions. In the second state, the environment executes your program and answers the question you have written.

This gives rise to the programming cycle as explained above.

Next

Next, we look at some common tricks you will need in your daily work with Prolog+CG.


PrevLite: 2.1 The Prolog+CG screen
NextLite: 2.3 Daily Prolog+CG usage

Prev: 2.1 The Prolog+CG screen
Up: 2 The Prolog+CG environment
Next: 2.3 Daily Prolog+CG usage