|
|
1 Presentation of Prolog
1.1 What is a Prolog program
Programming in Prolog is very different from programming in a traditional proceduralprocedural language like Pascal. In Prolog you don't say how the program will work. Prolog can be separated in two parts :
1.1.1 The Program
The program, sometimes called Database is a texte file (*.pl) that contain the facts and rules that will be used by the user of the program. It contains all the relations that make this program.
1.1.2 The Query
When you launch a program you are in query modequery mode. This mode is represented by the sign ? - at the begining of the line. In query mode you ask questions about relations described in the program.
1.2 Loading a program
loading
First you have to launch your Prolog compiler, for this report we used the SWI-Prolog wich is a freeware (if you want to know more about SWI-Prolog go to this page). When Prolog is launched the ?- should appear meaning you are in query mode. The manier to launch a program depends of your compiler. For SWI-Prolog you can load a program by typing the cammand [file]. when the file of your program is file.pl.
If you compiler is not SWI-Prolog you can also try the command reconsult(file). When you have done this you can use all the facts and rules that are contained in the program. Now let's begin to see what is a fact...
|
|