Difference Between Compiler and Interpreter: What Is A Compiler?
Difference Between Compiler and Interpreter: What Is A Compiler?
why compiler requires more memory without truly understanding the concept. Even a few What Is Aarogya Setu App? How it
teachers don’t know the concept of compiler and Works and how to install it?
all language compiler
interpreter so well as to teach their students! Cool Instagram Usernames for Girls
This morning, while speaking with one of my team and Boys
members, I once again remembered this classic Best Custom Robots.txt File for
compiler vs. interpreter comparison and I immediately decided to write a small piece about it. This Blogger/Blogspot
article will be useful for all the programmers wannabes.
Check Ticket Confirmation PNR
Status on WhatsApp
The problem is that we are not comfortable with binary and computers find our languages too
difficult to understand. To get around this problem a middle path of an intermediate language is used
to convey human commands to the computers. This intermediate language is called —the
programming language.
Programming language is not plain English. It is essentially a predefined syntax of writing logical
computer instructions which humans can also understand.
We also need something to convert programming language into binary language for the consumption
by computer. This is where compiler comes in scene.
Compiler is a software that checks a computer program (called source code) and lists all the errors
found. When humans remove all these errors, compiler converts the program into binary code (also
known as machine code or object code). Computers can understand binary code and therefore they
can execute instructions written by humans using programming language.
The following video will further help you in understanding the concept and working of a compiler:
What a Compiler Is
# COMPILER INTERPRETER
1 Compiler works on the complete program at Interpreter program works line-by-line. It takes
once. It takes the entire program as input. one statement at a time as input.
2 Compiler generates intermediate code, called Interpreter does not generate intermediate
the object code or machine code. object code or machine code.
3 Compiler executes conditional control Interpreter execute conditional control
statements (like if-else and switch-case) and statements at a much slower speed.
logical constructs faster than interpreter.
Compiled programs take more memory Interpreter does not generate intermediate
4 because the entire object code has to reside object code. As a result, interpreted programs
in memory. are more memory efficient.
Compile once and run anytime. Compiled Interpreted programs are interpreted line-by-line
5 program does not need to be compiled every every time they are run.
time.
Errors are reported after the entire program Error is reported as soon as the first error is
6 is checked for syntactical and other errors. encountered. Rest of the program will not be
checked until the existing error is removed.
8 Compiler does not allow a program to run Interpreter runs the program from first line and
until it is completely error-free. stops execution only if it encounters an error.
Compiled languages are more efficient but Interpreted languages are less efficient but
9 difficult to debug. easier to debug. This makes such languages an
ideal choice for new students.
Following image shows how different languages are either compiled or interpreted:
In comparison, interpreter is a more human-friendly program. It works quite a bit like humans work.
It begins program execution right at the first line and will go on showing you the result of the program
until it will hit an erroneous line of code. As a result, for programmer it is much easier to locate error
and to understand the nature of error. However, interpreter is slow. An interpreted programs gets
interpreted every time it runs.
Last updated: 10 March 2017 | Published on: 25 June 2015 | Authored and Edited by: Lalit Kumar
and Team | Filed as: Home » Programming » Difference between Compiler and Interpreter
Comments
Mo Savage says
You explain it like drinking water, please keep up the good job
Reply
sailoranchor says
Reply
mansi says
i have a few doubts regarding interpreter.it is written that interpreter does not generate an
intermediate machine code but later on in the last para it is written that interpreter interprets byte
code lineby line and generated machine code.so the interpreter is also generating machine code
and compiler also generates machine code which is here called intermediate code.so whats the
difference ??
Reply
Reply
Reply
nagesh says
Hi sir,
I have few questions here ,when you say that the compiler will produce INTERMEDIATE machine
code as per the difference 2 why is it referred as intermediate?
Its ultimately the machine code which is the final format that the underlying platform
understands right ?
If interpreter is not generating machine code then what is its output/interpreted result?
Reply
Code produced by compiler is often called intermediate code because that code may still
go through further medications (such as optimization) before becoming ready for
execution on the target machine.
Reply
Clash says
Why does java use both and what gets put into just in time compiler and java interpreter, that
requires both of them? Is is because some of the bytecode is faster through the compiler but not
all of it so it uses the interpreter or why?
Reply
thriveni says
Reply
Sir,
Thanks a ton….
It was really helpful and brilliantly elaborated. Cleared a lot of doubts especially with respect to
java.
I would like to know about the role of Just In Time (JIT) Compiler.
And, I am a beginner in Java , so if could kindly give me any contact of yours where I can clear my
doubts, it would be of great help.
Reply
Very nicely explained. I got my doubts cleared. Thank you for this article.
Reply
Reply
Fanía says
Best explanation ever, thank you so much, really.
Reply
ifeanyi says
Reply
Anshuman says
Thank You very much Sir. My question is : Are compiler and interpreter are inbuilt with windows
operating system or we have to install both the software separately. If they are inbuilt with
windows OS , then how to select one from both to check a source code.
Reply
Reply
Sir, this article very helpful for understanding the difference between compiler and interpreter…
Thank u so much..
Reply
Nice article …really helped me a lot …keep writing articles like this. It is the best explanation of
compiler and interpreter read by me till now..
Reply
kabare says
Reply
saba says
Reply
Mao says
Reply
Moiht says
Reply
Hi Mohit, compiler and interpreter do not really fit in the definition of system of application
software. But if you have to categorize, then I would say that compiler is more like an
application software because it does not play role when the compiled program is
executing. In contrast, the continuous need of interpreter during execution makes it more
like a system software.
Reply
Reply
Danish says
You did a great job and your language is simple to understand. It doesn’t seem that it’s written in
English; it’s like our mother tongue. Now I can differentiate very well between interpreter n
compiler and tell anyone. As you said most of the teachers don’t know about this. You are
absolutely right. Once again thanks a lot sir n keep doing this job.
Reply
Thank you Danish! I am happy that this article helped you in understanding the difference.
All the best for your future. Stay tuned with TechWelkin!
Reply
Thanks for the article. But, I have a small question – Why people say that compiled programs are
faster than interpreted ones?
Reply
Reply
mansi says
If the compiler is fast enough then why do we need to use interpreter even if both
do the same task.
Reply
qods says
Just for your encouragement: I appreciate and thank you very much for the information.
Regards.
Reply
Thank you for taking time out to write your kind words. I am glad that this article turned
out to be useful for you. Stay connected with TechWelkin!
Reply
जय श्री कृ णा
लिलिलत जी मै कं यूटर की A B C D भी नहीं जानता पर आपने जो िलखा उसे पढ़कर यह समझ सकता हू ँ िक ये जानकारी बहुत ही
उपयोगी है .
Reply
Shyamal Kumar Das says
Sir,
I worked as a programmer for 15 years, without having such a through knowledge about
compilers and interpreters. Simply I wrote programs in Clipper and compiled them to executable
files after proper linking.
Regards.
Reply
Shyamal, I am glad that you liked the article! Thank you for your comment. Stay connected
with TechWelkin!
Reply
Leave a Reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Post Comment
© 2007-2021 TechWelkin.
The content is copyrighted to Lalit Kumar and may not be reproduced on other websites.
TechWelkin displays Google AdSense ads. See how Google uses data when you're on TechWelkin | Privacy Policy