A programming language (by jargon abbreviated PL) is a "human-writable" language composed of words, syntactic and semantic rules, in which a person, "programmer", composes texts, so called "program source codes". These texts, these "program source codes", are then fed into a specially designed program that translates them into a "machine language" that the computer is able to "execute", and thereby create dynamical effects that were designed by the programmer:
(provisional figure) programmer \ translation program source code --------------> machine language
The specially designed translation program traditionally goes under two categories:
- Interpreter: that walks through the code of the program and translates code lines as it encounter them for immediate execution; once an interpreter has translated a line, the translation is dropped, and the interpreter continues to find source code, translate, execute and drop the translation, so the interpretation becomes somewhat slow;
- Compiler: a compiler instead translates the whole program once and for all to a new machine code version unreadable for any sane human, this machine code version is executed in place of the source code, and it is running fast.
Interpreters are contraintuitively still used for two reasons: the source code generally occupies much less space than machine code, and interpreters are generally designed so that the programmer step-by-step easily can experiment, test and design functions functions interactively, while this is much more complicated for compilers, that generally require a higher degree of personal administration and discipline for the program development.
As a compromise between compilers and interpreters
The machine code produced by a PL translator is very dependent on the computer architecture where it should run. Mac and PC, using vastly different central processor units, requires vastly different machine codes in order to execute the program correctly.
For the benefit of preserving space and having a program that runs on any computer architecture, various programming language providers have created so called virtual machines that execute specially designed "virtual machine codes" that are independent of the architecture. One can then imagine a fantasy computer architecture that doesn't actually exist, but which is "simulated" by many real existing computer architectures. For this to work the virtual machine needs to be implemented on the specific computer architecture as a software program, that one by one takes the instructions of the virtual machine and executes them. The benefit of this is that the virtual machine code program runs somewhat faster than a counterparting machine code, that it occupies slightly less space than this counterparting code, but foremost that it can run on every computer architecture. In this category we have: