Visual Prolog, also formerly known as PDC Prolog and Turbo Prolog, is a strongly typed object-oriented extension of
PrologProlog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in formal logic, and unlike many other programming languages, Prolog is declarative: The program logic is expressed in terms of relations, represented as...
. As Turbo Prolog it was marketed by
BorlandBorland Software Corporation is a software company headquartered in Austin, Texas.It is a Micro Focus company. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
, but it is now developed and marketed by the Danish firm Prolog Development Center (PDC) that originally developed it. Visual Prolog can build
Microsoft WindowsMicrosoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces...
GUIGui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...
-applications,
console applicationA console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems or the text-based interface included with some Graphical User Interface operating systems, such as the Win32 console in...
s,
DLLDynamic-link library , or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems...
s (dynamic link libraries), and
CGIThe Common Gateway Interface is a standard protocol for interfacing external application software with an information server, commonly a web server....
-programs. It can also link to
COM componentsComponent Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...
and to
databaseA database is an integrated collection of logically related records or files consolidated into a common pool that provides data for one or more multiple uses....
s by means of
ODBCIn computing, Open Database Connectivity provides a standard software API method for using database management systems . The designers of ODBC aimed to make it independent of programming languages, database systems, and operating systems....
.
Visual Prolog is compiled rather than
interpretedIn computer science, an interpreter is a computer program which reads source code written in a high-level programming language, transforms the code to machine code, and executes the machine code. Using an interpreter, a single source file can produce equal results even in vastly different systems...
, as is traditional for logic languages.
Visual Prolog, also formerly known as PDC Prolog and Turbo Prolog, is a strongly typed object-oriented extension of
PrologProlog is a general purpose logic programming language associated with artificial intelligence and computational linguistics.Prolog has its roots in formal logic, and unlike many other programming languages, Prolog is declarative: The program logic is expressed in terms of relations, represented as...
. As Turbo Prolog it was marketed by
BorlandBorland Software Corporation is a software company headquartered in Austin, Texas.It is a Micro Focus company. It was founded in 1983 by Niels Jensen, Ole Henriksen, Mogens Glad and Philippe Kahn....
, but it is now developed and marketed by the Danish firm Prolog Development Center (PDC) that originally developed it. Visual Prolog can build
Microsoft WindowsMicrosoft Windows is a series of software operating systems and graphical user interfaces produced by Microsoft. Microsoft first introduced an operating environment named Windows in November 1985 as an add-on to MS-DOS in response to the growing interest in graphical user interfaces...
GUIGui or guee is a generic term to refer to grilled dishes in Korean cuisine. These most commonly have meat or fish as their primary ingredient, but may in some cases also comprise grilled vegetables or other vegetarian ingredients. The term derives from the verb, "gupda" in Korean, which literally...
-applications,
console applicationA console application is a computer program designed to be used via a text-only computer interface, such as a text terminal, the command line interface of some operating systems or the text-based interface included with some Graphical User Interface operating systems, such as the Win32 console in...
s,
DLLDynamic-link library , or DLL, is Microsoft's implementation of the shared library concept in the Microsoft Windows and OS/2 operating systems...
s (dynamic link libraries), and
CGIThe Common Gateway Interface is a standard protocol for interfacing external application software with an information server, commonly a web server....
-programs. It can also link to
COM componentsComponent Object Model is a binary-interface standard for software componentry introduced by Microsoft in 1993. It is used to enable interprocess communication and dynamic object creation in a large range of programming languages...
and to
databaseA database is an integrated collection of logically related records or files consolidated into a common pool that provides data for one or more multiple uses....
s by means of
ODBCIn computing, Open Database Connectivity provides a standard software API method for using database management systems . The designers of ODBC aimed to make it independent of programming languages, database systems, and operating systems....
.
Visual Prolog is compiled rather than
interpretedIn computer science, an interpreter is a computer program which reads source code written in a high-level programming language, transforms the code to machine code, and executes the machine code. Using an interpreter, a single source file can produce equal results even in vastly different systems...
, as is traditional for logic languages. This provides the important improvement of converting traditional Prolog-typical runtime-errors to compiler warnings, which ensures a better
robustnessRobustness is the quality of being able to withstand stresses, pressures, or changes in procedure or circumstance. A system, organism or design may be said to be "robust" if it is capable of coping well with variations in its operating environment with minimal damage, alteration or loss of...
of the finished applications.
The core of Visual Prolog are
Horn clauseIn mathematical logic, a Horn clause is a clause with at most one positive literal. They are named after the logician Alfred Horn, who first pointed out the significance of such clauses in 1951....
s,
pattern matchingIn computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. In contrast to pattern recognition, the pattern is rigidly specified. Such a pattern concerns conventionally either sequences or tree structures...
and controlled non-determinism like in traditional Prolog, but unlike traditional Prolog, Visual Prolog has always been
strongly and statically typedA data type in programming languages is a set of values and the operations on those values.-Overview:Almost all programming languages explicitly include the notion of data type, though different languages may use different terminology...
. Since version 6.0 the language has been fully object-oriented, and in version 7.0 parametric polymorphism was introduced. Version 7.2 introduces anonymous predicates (a logical pendant to anonymous functions).
Hanoi Example
In the 'Towers of Hanoi' example, the Prolog inference engine figures out how to move a stack of any number of progressively smaller disks, one at a time, from the left ('left') pole to the right pole ('right') in the described way, by means of a center ('center') pole as transit, so that there's never a bigger disk on top of a smaller disk. The predicate 'hanoi' takes an integer = the number of disks, as an initial argument.
In real-life, Visual Prolog is especially suited for intricate problems, such as resource planning, etc.
As the example shows, Visual Prolog can be used for quick 'programming in the small,' but it is mostly employed for industrial-strength large applications.
class hanoi
predicates
hanoi : (unsigned N).
end class hanoi
implement hanoi
domains
pole = string.
clauses
hanoi(N) :- move(N, "left", "centre", "right").
class predicates
move : (unsigned N, pole A, pole B, pole C).
clauses
move(0, _, _, _) :- !.
move(N, A, B, C) :-
move(N-1, A, C, B),
stdio::writef("move a disc from % pole to the % pole\n", A, C),
move(N-1, B, A, C).
end implement hanoi
goal
console::init,
hanoi::hanoi(4).
Books about Visual Prolog
External links