Blog‎ > ‎Blog Posts‎ > ‎

What Is The Difference Between A Compiler And A Interpreter??

posted Jul 31, 2017, 8:15 AM by Rohit Bhaskar   [ updated Aug 20, 2017, 7:59 AM ]

There are a lost of articles and posts on this topics already and ‘IF’ you are a computer science engineering student, there is a very good probability that you already know this. So feel free to skip this post. But for everyone else, its a really important thing to understand!…… No pressure 🙂

Before we understand what the difference between a compiler and an interpreter is, we 1st need to understand what each one of them is… and even before that what and where they used.

So what do you think happens to those huge codes that coders write?? Almost each code goes through “scrutiny” by the system before ‘execution’. (Execution of the code is nothing but doing whatever is written in the code). By scrutiny, i mean that the code is checked for errors, (Errors are unexpected conditions that are not part of the normal operation of the code) and also, the flow of the code is made clear to the processor.

Now this checking for errors is done in 2 ways….more like at 2 stages actually. The check can be done before the execution of the code or it can be done for each line of code. This is the main difference between a Compiler and an Interpreter. A Compiler checks the code completely before any thing is executed, whereas an interpreter check only 1 line at a time and executes it (more like a run-time check).

(A special note! Java has an interpreter and a compiler! Yes! The compiler for JAVA code creates something called as Java Bytecode. This JAVA Bytecode is passed to an in-time-compiler or interpreter! Awesome isn’t it?)

This just an overview to the difference between them. To understand it better, you will need to search and read a bit more. So try out this page while you are at it.

Hope you liked this post! Comment below if you need an particular topic or if there’s something you don’t fully understand! I would be happy to help.

Comments