What are the differences between compiler and an interpreter ?


A compiler is a computer program which translates the code written in a high level language into a low level language. Mostly into machine code (binaries – zeros and ones) in order to execute the code, or you can say to get an output.

Some of the examples of compiled programming languages are : C, C++, C#, Java, Rust, Swift.

Feel free to refer to this article for more information about high and low level languages


An interpreter is a computer program which directly produces output of a high level language without converting the code written into machine code in your computer. YES IT DOES USE MACHINE CODE FOR EXECUTION BUT IT HAPPENS INSIDE ITSELF. That’s why interpreters are often referred as virtual machines. It also uses some techniques to identify the output of a code correctly without any need of compiling it.

Some of the examples of interpreted programming languages are : Python, Ruby, JavaScript and PHP


Compiler Interpreter
1. It converts the code into machine code for execution.1. It does not convert the code into machine code for execution. Instead it uses some techniques to get the result
2. While using a compiler, you are letting your computer execute the code2. An interpreter itself analyses and executes the code. Hence it is also sometimes called a Virtual Machine.
3. It processes the entire code at a time3. It analyses each line of code one by one.
4. Debugging and syntax error fixing are difficult because of its design4.. Debugging is comparatively easier than compilers.
5. Once a code is compiled, it is kind of saved and does not require the code again for execution5. It requires the code every time it is needed to execute
compiler vs interpreter