Compiler vs. Interpreter

A compiler converts the entire program into executable code before running, when running the program only the executable version of the code is running.

An interpreter converts the code during run time; it converts the code 1 line at a time at the time that it is running.

An interpreter translates some form of source code into a target representation that it can immediately execute and evaluate. The structure of the interpreter is similar to that of a compiler, but the amount of time it takes to produce the executable representation will vary as will the amount of optimization.

Compiler characteristics:

* spends a lot of time analyzing and processing the program
* the resulting executable is some form of machine- specific binary code
* the computer hardware interprets (executes) the resulting code
* program execution is fast

Interpreter characteristics:

* relatively little time is spent analyzing and processing the program
* the resulting code is some sort of intermediate code
* the resulting code is interpreted by another program
* program execution is relatively slow

A programming language can be made into a working program either by Interpretation or compilation. There isn't a Compiler and an Interpreter language. But any code any be made into a program by compiling it using an Interpreter (checks a line of your code at a time and stops at errors) or compiler (checks the entire code at a time and displays all errors at the end).

Examples:
BASIC is a teaching language, it is usually interpreted. FORTH (for radio telescopes) and LOGO (for floor crawlers) are other languages which are usually interpreted, since they are robotic.
Languages which are used for commercial programming will nearly always be compiled. C, C++, C# are nearly always compiled, and so is Pascal and all its derivatives (Oberon, Delphi &c.).

0 प्रतिक्रिया :

Post a Comment