Compiled ExecutionThe purpose of programming languages is to facilitate the communication of algorithms to the computer. Programming languages are tools for programmers and represent a formal notation to express algorithms. An algorithm is an abstract concept, independent of any notation, but without a notation it is not precisely expressed or communicated to others, and verifying it is quite difficult. The communication interface with the computer is a binary language, difficult to grasp for the human mind, called machine language. Machine language is binary because the internal structure of computers is binary. Various architectures and different CPU types imply a variety of machine languages, normally incompatible with each other. From the theoretical point of view a machine language is a descriptive language whose sentences are not produced by a generative language. By contrast, usual programming languages are different from machine language because they are generated by context independent grammars. That is why, when passing from a programming language to a machine language it is needed to translate sentences built in the programming language into machine language sentences that make sense for the hardware. This process is called compiling and the software tool that makes this process possible is a compiler.
Consider the following code sequence expressed in Java™:
int[] vector = {6,1,89};
For the human reader acquainted with Java™, the code means summing all the elements of a vector. For the computer it is only a character sequence like any other. The Java™ compiler transforms this source code into machine code executable on the Java™ platform. The assembly language equivalent of the machine code sequence generated by the Java™ compiler is:
0: iconst_3
This code works with the local stack, with the constant pool and uses methods from other classes. The Java™ virtual machine executes this code and the result complies to the original Java™ instructions. |
|