Interpreter Vs Compiler : Differences Between Interpreter and Compiler
Computer programming languages are classified into 3 categories:
1. Machine language,
2. Assembly language, and
3. High level language.
Computers can not understand high level language or assembly language.
Computers only understand the machine language.
As a result, we need a translator, which converts a program written in high level language or assembly language (source code) into machine language (object code).
A compiler or an interpreter is a program that translates high-level languages (source code) into machine language (object code).
A compiler converts the entire program into machine code at one go.
An interpreter translates the source code line by line, that is, it would execute the current statement before translating the next statement.
There are also other differences,
For details please visit the site:
https://youtu.be/Iu9qf0U3whA
Hi Aspirant!
As we know that the machine only understands the binary language, that is the language written in 0's and 1's, called the machine code for a program. To convert source code into machine code, we use either a compiler or an interpreter. Difference between interpreter or compiler:
- Interpreter translates program one statement at a time and compiler scans the entire program and translates it as a whole into machine code.
- Interpreter takes less time to analyse the source code , but the execution time is more than that of compiler. For compiler it is vice-versa.
- No Object Code is generated in case of interpreter, hence are memory efficient. While compiler generates Object Code which further requires linking, hence requires more memory.
- Example of language which use compilers are java, C, C++ and for interpreters it is JavaScript, Python, Ruby, etc.
Thankyou!
Hello,
To convert source code into machine code we use either a compiler or an interpreter
Both compilers and interpreters are used to convert a program written in a high level language into machine code understood by computers there are differences between how an interpreter & a compiler works
Interpreter -
•Interpreters usually take less amount of time to analyze the source code the overall execution time is comparatively slower than compilers
•Programming languages like JavaScript Python Ruby use interpreters
•Translates program one statement at a time
Compiler -
•Compilers usually take a large amount of time to analyze the source code the overall execution time is comparatively faster than interpreters
•Programming languages like C Java use compilers
•Scans the entire program & translates it as a whole into machine code
Hope it helpful.
Thankyou.