Fundamentals- [Programming Language]

♠ Posted by Unknown in , at 09:33

Compiler :

A computer hardware is capable of understanding only machine level instructions, so it is necessary to convert the instructions of a program written in high-level language to machine instructions before the program can be executed by the computer.  In case of a high-level language, this job is carried out by a compiler.  Thus, compiler is a translating program that translate the instructions of high-level language into machine language.  A program written by a programmer in a high-level language is called a source program.  After this source program has been converted into machine language by a compiler, it is referred to as an object program.
Image: Work of Compiler
A compiler is so called because it compiles a set of machine language instructions for every program instruction of a high-level language. A language compiler is only capable of translating source programs which have been written for that particular language each machine requires a separate compiler for each high-level language.
When compiling the source program compiler performs the following operations.


  1. Compiler displays all syntax errors in the source program at a time with line number, appropriate error message and return to the source program.  Compiler cannot create object code while source program become error free.
  1. Compiler creates the permanent executable file (.EXE) of the source program, which is separate from the source program and is used to run and generate the output of the program.


Interpreter :

An interpreter is another type of translator used for translating high-level languages into machine code.  It takes one statement of a high-level language and translates it into a machine instruction which is immediately executed.  Translation and execution alternate for each statement encountered in the high-level language program.  In other words, an interpreter translates one instruction, and the control unit executes the resulting machine code, the next instruction is translated and the control unit executes the machine code instruction, and so on.

Interpreter are often employed with microcomputers. The advantage of an interpreter over a compiler is fast response to changes in the source program.  The interpreter eliminates the need for a separate compiling run after each program change to add features or correct errors.



0 comments:

Post a Comment