From Just Solve the File Format Problem
Jump to: navigation, search
File Format
Name Prolog
Extension(s) .pl, .pro, .P
Wikidata ID Q163468
Released 1972

Prolog is a language based on very different principles from nearly all other programming languages. While most other languages are either imperative/procedural (consisting of a series of operations to be performed in linear sequence, with some constructs altering program control with branches, loops, and other such things), object-oriented (where the operations and the data they operate on are encapsulated in objects with associated methods, attributes, and message-passing), or functional (those languages like LISP that are hard to grasp by people more accustomed to the other sorts), Prolog is instead based on logical predicates, a series of expressions giving facts from which inferences may be made, like "Socrates is a man" and "All men are mortal", from which you can then make a query, like "Is Socrates mortal?" and get a Yes/No response. Or, in Prolog syntax:

mortal(X) :- man(X)

?- mortal(Socrates)

Prolog programs consist of whole bunches of such expressions, designed to churn out some fact derived from all of them.

Of course, to be a full-featured programming language, Prolog also needs to do such things as input, output, graphics, file storage, and so on. Various expressions have been devised to do this, containing "side effects" that do the things the programmer wants, but expressed in the form of a logical statement as demanded by Prolog. This can start seeming to the programmer like a kind of contrived gimmick, like expressing answers in the form of a question on the game show Jeopardy!.

Developing a compiler for Prolog can be quite a challenge, since the structure of the language leads to a potentially huge combinatoric explosion of possible combinations of logical statements attempting to resolve the supplied question, most of them blind alleys. This means that a Prolog program is likely to be slow and inefficient compared to one in another language unless the compiler is very well optimized.

In the 1990s, Borland released a version of Prolog called "Turbo Prolog", which was actually developed by a Danish company which now offers it as Visual Prolog.

While Prolog is used in academia, it has not received much use for real-world projects. So, despite its innovative structure, it is probably not the future of programming, but as they say, "The past is Prolog." (Or something like that...)


Personal tools