[X]
IT Technology

Difference Between Compiler and Interpreter

Compiler vs Interpreter

Summary: Difference Between Compiler and Interpreter is that a compiler is a separate program that converts the entire source program into machine language before executing it. The machine language version that results from compiling the 3GL is called the object code or object program. While An interpreter reads a code statement, converts it to one or more machine language instructions, and then executes those machine language instructions. It does this all before moving to the next code statement in the program. Each time the source program runs, the interpreter translates and executes it, statement by statement.

Difference Between Compiler and Interpreter

Compiler

A compiler is a separate program that converts the entire source program into machine language before executing it. The machine language version that results from compiling the 3GL is called the object code or object program. The compiler stores the object code on storage media for execution later.

While it is compiling the source program into object code, the compiler checks the source program for errors. The compiler then produces a program listing that contains the source code and a list of any errors. This listing helps the programmer make necessary changes to the source code and correct errors in the program. A compiler translates an entire program before executing it. An interpreter, by contrast, translates and executes one statement at a time.

Interpreter

An interpreter reads a code statement, converts it to one or more machine language instructions, and then executes those machine language instructions. It does this all before moving to the next code statement in the program. Each time the source program runs, the interpreter translates and executes it, statement by statement. An interpreter does not produce an object program. One advantage of an interpreter is that when it finds errors, it displays feedback immediately. The programmer can correct any errors before the interpreter translates the next line of code. The disadvantage is that interpreted programs do not run as fast as compiled programs.

Hundreds of procedural languages exist. Only a few, however, are used widely enough for the industry to recognize them as standards. These include C and COBOL. To illustrate the similarities and differences among these programming languages, the figures on the following pages show program code in these languages. The code solves a simple payroll problem — computing the gross pay for an employee.

The process used to compute gross pay can vary from one system to another.

Also Read:

Difference Between Low Level Language and High Level Language

Difference Between Procedural Language and Object Oriented Language

Difference Between Object Oriented Programming and Structured Programming

Difference Between Macros and Functions

Difference Between Low Level Language and Assembly Language

Difference Between Control Structures and Control Statements

Difference Between Browser and Search Engine

Leave a Comment