Python Word
Python Word
S MANJULA
CSM-B
22951A6665
WHAT IS COMPILER?
•A compiler is a computer program that transforms code written in a high-level
programming language into the machine code. It is a program which translates
the human-readable code to a language a computer processor understands
(binary 1 and 0 bits). The computer processes the machine code to perform the
corresponding tasks.
•A compiler should comply with the syntax rule of that programming language in
which it is written. However, the compiler is only a program and can not fix errors
found in that program. So, if you make a mistake, you need to make changes in
the syntax of your program. Otherwise, it will not compile.
WHAT IS INTERPRETER?
• Compiler transforms code written in a high-level programming language into the machine
code, at once, before program runs, whereas an Interpreter converts each high
-level program
statement, one by one, into the machine code, during program run.
• Compiled code runs faster while interpreted code runs slower.
• Compiler displays all errors after compilation, on the other hand, the Interpreter displays
errors of each line one by one.
• Compiler is based on translation linking-loading model, whereas Interpreter is based on
Interpretation Method.
• Compiler takes an entire program whereas the Interpreter takes a single line of code.
KEY DIFFERENCE
• An interpreter for python is an important concept for web
development and computer programming. A Python interpreter and
compiler are quite similar to one another. Essentially, they both do the
same job, but in very different ways. Each has a slightly different
procedure when generating a source code, but the end result remains
the same.
• Python interpreter uses a line-by-line approach whereas the
compiler opts for a whole program approach. They both have their
advantages and disadvantages but they make the overall process
quicker and easier for all.
DIFFERENCES BETWEEN COMPILER AND INTERPRETER
Basic
Compiler Interpreter
Difference
•Create the program.
Running time Compiled code run faster Interpreted code run slower
It is based on language
Model translation linking -loading It is based on Interpretation Method.
model.
• Compliers reads the source code, outputs
executable code
• Translates software written in a higher-
level language into instructions that
computer can understand. It converts the
text that a programmer writes into a
ROLE OF format the CPU can understand.
COMPILER • The process of compilation is relatively
complicated. It spends a lot of time
analyzing and processing the program.
• The executable result is some form of
machine-specific binary code.
• The interpreter converts the source code
line-by-line during RUN Time.
• Interpret completely translates a program
written in a high-level language into
machine level language.
ROLE OF • Interpreter allows evaluation and
INTERPRETER modification of the program while it is
executing.
• Relatively less time spent for analyzing
and processing the program
• Program execution is relatively slow
compared to compiler
Compiler and interpreter both are intended to do
the same work but differ in operating procedure,
Compiler takes source code in an aggregated way
whereas Interpreter takes constituent parts of
source code, i.e., statement by statement.
CONCLUSION
Although both compiler and interpreter have
certain advantages and disadvantages like
Interpreted languages are considered as cross-
platform, i.e., the code is portable. It also doesn’t
need to compile instruction previously unlike
compiler which is time-saving. Compiled languages
are faster regarding the compilation process.