There are compilers for prolog but other websites say that the language itself is an interpreted language. I'm confused if prolog is really an interpreted language. Can someone please clarify if what the language really is? Compiled language or Interpreted language?
To answer this, let’s nail down some definitions.
A compiled language is one that converts source code files to a form (binary, byte code, etc.) for standalone execution or into a library for linking with other programs. The constructs are fixed and cannot be amended.
An interpreted language is one that converts a construct into a form that can be executed after conversion. Each converted construct is typically put into a store that can be referenced by later constructs.
Now many programming languages can be both compiled and interpreted, there is no rule that says a programming language can only be one or the other.
In the early days most programming languages were one or the other, e.g. C++ - compiled, BASIC - interpreted.
Now to answer your question:
Prolog: a compiled or interpreted language or both?
The Prolog language can be compiled and can be interpreted so the answer is both.
The reason you are seeing different answers for different sites is that you are asking about the language, think of the Prolog language as an abstract concept, but looking at specific implementations, think of the sites as referring to a concrete implementation. So some entities do one or the other and some do both.
In the last several years, in my opinion, the consensus is becoming that if you have a main stay programming language it has to have a compiler to generate efficient code and an REPL which uses an interpreter for quick development of constructs.
Typically the trend is to develop and test basic programming constructs using the REPL and then move them into source code files that will be compiled to build up libraries. The libraries are then referenced from the REPL; rinse and repeat.
Interestingly Prolog was the first language I used that had both, and that was back in the 1980's.
If you read ISO/IEC 13211 Information technology -- Programming languages -- Prolog -- Part 1: General core
it states:
The language originates from work in the early 1970s by Robert A. Kowalski while at Edinburgh University (and ever since at Imperial College, London) and Alain Colmerauer at the University of Aix-Marseilles in France. Their efforts led in 1972 to the use of formal logic as the basis for a programming language. Kowalski’s research provided the theoretical framework, while Colmerauer’s gave rise to the programming language Prolog. Colmerauer and his team then built the first interpreter, and David Warren at the AI Department, University of Edinburgh, produced the first compiler.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With