Compilers and Interpreters

compilers and interpreters - iboothub

Have you ever wondered how computers can  understand a  million lines of codes written by humans? Compilers  and interpreters are the programs that help computers achieve that level of understanding.

COMPILER:

A compiler is a computer program that transforms human-readable code written in a high-level programming language into machine code. Thus, it translates the human-readable code to a language a computer processor understands (binary 1 and 0 bits). The computer processes the machine code to perform the corresponding tasks.  Typically, a compiler should comply with the syntax rule of that programming language in which it is written. This means that the compiler cannot fix errors found in a program. These errors are therefore expected to be fixed by the user otherwise it will not compile. Examples of compiled high-level  languages include C, C++, C#, Java, Erlang, F#, Julia, etc.


INTERPRETER:

An interpreter is also a computer program that translates each high-level program statement into the machine code. This includes source code, pre-compiled code, and scripts. Both compiler and interpreters do the same job which is converting higher-level  programming language to machine code. However, a compiler will convert the code into machine code (create an exe) before the program will run. Interpreters convert code into machine code when the program is executed.


The table below gives further details for the differences between compiler and interpreter:

CompilerInterpreter
A compiler translates the entire source code of a programming language into executable machine code.  An interpreter takes a source program and runs it line by line, translating each line as it comes to it.
A significant amount of time is used to analyze the entire source code but the overall execution time of the program is comparatively faster. An interpreter takes less amount of time to analyze the source code but the overall execution time of the program is slower.
Debugging can be hard as the compiler program only generates an error message only after scanning the entire program and the error can be present anywhere in the program.  Debugging is easier as it continues translating the program until the error is met.
The compiler requires a lot of memory for generating machine codes.It requires less memory than a compiler because no machine code is generated.
Generates intermediate object code. No intermediate object code is generated.
A Compiler  is more useful when considering security.The interpreter   can be vulnerable in case of security.
Examples: C, C++, Java, Julia, F#Examples: Python, Perl, JavaScript, Ruby

Total
0
Shares
1 comment
Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post
EU agree - iboosthub

European Union Lawmakers agree on data reuse rules to foster AI and R&D

Next Post
Kali Linux 2021-4 - iboosthub

Kali Linux 2021.4 Released With Hacking Tools Updated

Related Posts