What Is Compiler And Interpreter?

Compiler and Interpreter are computer programs that translate high-level programming languages into machine code. However, there is some difference.

Why We Need Compiler And Interpreter?

Computers understand only Machine Language also known as Machine Code. Machine Codes are consists of Binary Code, which are sequences of the 0s and 1s. Machine Language is specific to computer’s architecture and directly executed computer’s processor, which require lowest level of abstraction and is the most fundamental form of programming language understood by computers. In short writing programs directly in machine language is complex and error-prone for humans due to its binary representation and dependence on specific hardware architectures.

On the other hand High Level Programming Languages are designed to be more readable and writable by humans. They provide abstractions and structures that make programming easier and more efficient. High-level languages need to be translated or compiled into machine language instructions before they can be executed by the computer. This translation is performed by compilers or interpreters specific to each high-level language and target platform.

What Is Compiler?

The compiler is the System Software that  reads the whole source code of a program and translates it into machine code. This machine code is then stored in a file, which can then be executed by the computer.

What Is Interpreter?

The Interpreter is the System Software that  reads and executes the source code of a program line by line. This means that the interpreter does not need to translate the entire source code into machine code before the program can start to execute.

Both Compiler and Interpreter are used in computer programming languages for the same purpose but they are slightly different from each other.

Different Between Compiler And Interpreter.

Here is a key difference between Compiler and Interpreter.

1. Translation

Compiler converts the whole source code into binary file which contains the machine code. Then the machine code can be executed.

Interpreter does not convert source code into machine code, insted translate the source program line by line to the machine code and execute.

2. Speed

Compilers are fast as compare to interpreters

Interpreters are slow as compare to compilers

3. Memory

Compilers uses more memory then interpreters

Interpreters uses less memory then compilers.

4. Error Detection

Compiler checks the whole program and detect and list all errors at once while compiling the source program.

Interpreter detect error while executing the program, if any error found terminate the execution process and list the error.

5. Portability

Compiler based programs are more portable then Interpreter based programs.

Interpreter based programs are less portable then compiler based programs.

6. Source Program

Compilers are mostly used for programming languages. E.g C, C++, C#, Java etc

Interpreters are mostly used for scripting languages. E.g Javascript, PHP, Python, Ruby etc

Deals Of The Day

Discover more from Easymux

Subscribe now to keep reading and get access to the full archive.

Continue reading