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.
|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 code||2. 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 time||3. It analyses each line of code one by one.|
|4. Debugging and syntax error fixing are difficult because of its design||4.. 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 execution||5. It requires the code every time it is needed to execute|