Compilation and Execution Process

Generally coding is done in high level language or low level language (assembly language). For the computer to understand these languages, they must be translated into machine level language. The translation process is carried out by a compiler/interpreter (for high level language) or an assembler (for assembly language program). The machine language code thus created can be saved and run immediately or later on.

In an interpreted program, each program statement is converted into machine code before program is executed. The execution occurs immediately one statement at a time sequentially. BASIC is one of the frequently used interpreted language. In contrast to interpreter, a compiler converts a given source code into object code. Once an object code is obtained, the compiled programs can be faster and more efficient than interpreted programs.

Compilation Process

A source code must go through several steps before it becomes an executable program. In the first step the source code is checked for any syntax errors. After the syntax errors are traced out a source file is passed through a compiler which first translates high level language into object code (A machine code not ready to be executed). A linker then links the object code with pre-compiled library functions, thus creating an executable program. This executable program is then loaded into the memory for execution. General compilation process is shown in Figure below:

Compilation Process
Figure : Compilation Process