The "Sweet" Prolog
Strawberry Prolog gains popularity among the Academy community

September'2000

By Peter Ganev
       About fifteen years ago the language Prolog was much more modern than Java is nowadays, but because of its appetite for memory, processing time and the lack of good Prolog compilers little by little it was forgotten. We introduce to you a new product - Strawberry Prolog (www.dobrev.com). It has the ambition to retrieve the glory of the language Prolog.
         Prolog belongs to the next generation compared to procedure languages of the type of C and Pascal like they are the next generation compared to Assembler. With the procedure languages the programmer does not say what is the task but what is the way for its solution. The code contains commands of the type: "Take the contents of this memory cell (variable) and add it to this number and write the result in another cell." That kind of programming produces quick and efficient programs but it requires time and professionalism. The idea with Prolog is to be described the task and the solution to be left to the compiler. The program consists of a list with facts (axioms) and rules through which from the given facts new ones can be worked out. Here is an example for a fact recorded in the syntax of Prolog:
loves (john, whisky).
         We are not going to explain what does this fact say, taking advantage of the self- explainability (one good feature of Prolog), i.e. people who have never seen a program written in Prolog read and understand it. This is an example for a rule:
loves (john, X):-loves (X, whisky).
         Here :- means "if" and X means variable, i.e. everyone. The above can be read in the following way: John loves everyone who loves whisky.
         With the facts and rules we describe the things we know. To create a program only a question has to be added. For example:
?-loves (john, john).
         That is: does John love himself. The answer will be yes (explain why). As you can see, the Prolog program does not resemble the familiar to you programs of procedure languages as C, for example. It may even seem a bit unserious but it can be understood even by someone who has never been into programming. If you install to your computer Strawberry Prolog and play with the example programs you will find out that this is a feature of the language. Without having studied Prolog you will understand a lot from the programs, and if you want to learn more you have at your disposal a splendid Help 
containing useful information and a Tutorial. 
         An important advantage of Strawberry Prolog is its connection to the Internet. The product maintains SQL data base (My SQL for the moment and for the future ODBC will be maintained), and with its help OLE servers can be run and CGI Scripts can be written. Internet Sockets can be maintained (look Strawberry Chat - a chat program created in Prolog). 
         The maintenance of the technology COM (the running of OLE servers and ActiveX objects) is viewed as one of the most prospective areas in which the product is developed. Speaking of the running of applied programs as MS Word, Excel, Corel Draw, etc. For the time being few compilers maintain the running of OLE servers (Visual Basic and Delphi, for example). An important part of the work with OLE servers is the instrument Object Browser. With its help you can see what OLE servers are installed on your computer, what are their methods, objects and properties. You will be amazed how many OLE servers there are on your computer.
         Another new technology is Strawberry Prolog CGI Script. This gives you the opportunity to write programs working on the server. This makes Prolog a real alternative of Perl.
         In important instrument for every compiler is the debugger. Without it it would be impossible for any program to be run. It is not by coincidence that the authors of Strawberry Prolog have put a lot effort in that area. Its most important part is the instrument Proof Tree - a window in which you can see the execution of your program step by step. The creators of Strawberry Prolog - a team of computer scientists with their leader Dimiter Dobrev (a mathematician from the Bulgarian Academy of Science) are working on Prolog Plug-In. This will make Prolog a real alternative of the Java aplets and will enable your program simply to be put on the Web page without additional correction.
         For the time being, the environment of Strawberry Prolog works only under Windows 95/NT, no matter that the core of the product runs under Linux and UNIX. In near future a Macintosh version is planned. The aim is Strawberry to become an environment for the development of a platform independent software.
         Strawberry Prolog is an interesting product and it is worth spending a few minutes for it (you can find the working version on the disk of this edition). The installation and uninstallation are automatic and will not be a problem for you.