Compiler vs Interpreter

·

2 min read

We all know that computers only understand ones and zeros, and that code written in machine language and assembly language is referred to as low level code, whereas The term high level language refers to languages that are simple to read, write, and maintain , such as Python, C, C++, or JavaScript.

These files written in specific level languages must be transformed to ones and zeros in order for a computer to understand them, and the converted code is known as machine code or object code.

Certain computer languages use compilers and interpreters to translate high-level languages to machine code.

Let's look at the differences between compiler and interpreter :

  1. Languages like C++, Java, and C use a compiler to convert the entire programme into a single file at once called object code, which can be run on any system that supports that language. There will also be no requirement for source code to run that software. However, Languages like JavaScript use an interpreter that translates the program line by line as it runs. We also require the source code because the conversion is done line by line.

  2. After compilation, compiled languages display a list of all errors at once, which makes debugging difficult in production, but there will be no problems with the program once its error-free. Interpreter gives run-time errors mentioning where the error is as it converts line-by-line.

  3. Since it compiles at once, it is faster to execute where as, interpreter runs line by line so it is slower when compared to the compiler.

The distinction between a compiler and an interpreter can be explained by contrasting English subtitles with auto-generated subtitles : English subtitles (produced by the content source) are created once and can be viewed at any time, whereas auto-generated subtitles must be translated in real-time every time they are opened.

I'm writing notes as I learn. So, I'd like feedback since it helps me write more efficiently, and if there are any recommendations or errors, I'd much appreciate your response.