Compilation:-



Compilation is the phase or pre-step of execution where a program source code is converted into object code and then transferred for execution as per commanded by the user. A Compiler is a utility program which converts to high level program code into machine level code or binary level code which further is ready to be executed, The work of a compiler is basically considered in two ways, the first one is to check the errors in the program and the second one is to convert this into object code then after this sends the object code for execution.

The compilation event is handled by three different utility programs in some kind of programming languages:-

  • Assembler • Assembly Level
  • Compiler • High Level Languages
  • Interpreter – High Level Languages

Assembler

An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer’s processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.

Typically, assemblers make two passes over the assembly file:-

  • First pass: reads each line and records labels in a symbol table.
  • Second pass: use info in symbol table to produce actual machine code for each line.

compiler

Compiler entire program at once; if no error then sends for execution.

A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses. Typically. a programmer writes language statements in a language such as pascal or C one line a time using an editor. The file that is created contains what are called the source statements, The programmer then the appropriate language compiler, specifying the name of the that contains the source statements.

When executing (running), the compiler first analyzes all of the language statements syntactically one after the other, like Syntax errors, Range issues and some else and in case if any error exists then it informs about the error to rectify first. After fixing the error you need to recompile the program and then it allows executing if there is no more error remained in the program. Traditionally, the output of the compilation has been called object code or sometimes an object module. (Note that the term “object” here is not related to object-oriented programming) The object code is machine code that the processor can process or “execute” one instruction at a time.

Interpreter

An interpreter checks the program code line by line; continues execution even if there is any error after the second line. When finds any error, this then informs to rectify the mistake.

Interpreter is another kind of program translator which is used to convert the high level language into machine level information. Interpreter is used in mostly fourth generation languages (4GL) like Visual basic, Web driven applications etc. Unlike Compiler an Interpreter interprets the program code into machine code line by line not whole at once. Whereas A compiler compiles a program source code but whole at once and if there is any error it fetches and informs you to rectify that but in case of Interpreter if interprets one line and send it for execution if there is no error in that and further wise if found any error it then informs you about the error and prompt you to break the program execution flow.