You are on page 1of 1

What Is Compiler?

Compiler is a computer program that is developed to translate the high-level


language (source code) into a computer-readable format known as low-level language
or machine code. It reads the whole source code at once, compiles it, and then
generates an executable file from it. Which is later executed or ran by us, in
order to perform the instruction we programmed. And while reading the source code
it returns all the errors at once if there are any.

Advantages And Disadvantages Of Compiler And InterpreterAdvantages Of Compiler


Runs Faster → It runs faster than the Interpreter since the source code is already
compiled and we only need to execute the executable file is generated.

Optimized → Machine code of executable file generated with a compiler is often a


native machine instruction for the targeted machine which is well optimized and
runs faster.
Secure → Executable files generated from the compiler can be executed on any of
your clients or other systems without the need for actual source code. Which makes
your program unhackable, secure and private
No dependencies → Your client or anyone else doesn’t need any compiler,
interpreter, or third party program to be installed in their system, for executing
the shared executable file of your source code.
Download JavaScript Cheatsheet in PDF
Disadvantages Of Compiler
Extra Memory → It occupies extra memory since it needs to generate a new file.
Extra step → Unlike interpreter, we can’t run our source code directly, we need to
additionally run the executable file.
Incompatibility issue → Since its code is optimized for the system it was executed
on, which many times leads to system incompatibility issue even if the system is
running on the same OS.
Harder to Debug → After reading the whole code it returns all errors at once if
available, which makes it harder to navigate and fix the error. Also
Advantages Of Interpreter
Cross-Platform → In interpreted language we directly share the source code which
can run on any system without any system incompatibility issue.
Easier To Debug → Code debugging is easier in interpreters since it reads the code
line by line, and returns the error message on the spot. Also, the client with the
source code can debug or modify the code easily if they need to.
Less Memory and Step → Unlike the compiler, interpreters don’t generate new
separate files. So it doesn’t take extra Memory and we don’t need to perform one
extra step to execute the source code, it is executed on the fly.
Execution Control → Interpreter reads code line by line so you can stop the
execution and edit the code at any point, which is not possible in a compiled
language. However, after being stopped it will start from the beginning if you
execute the code again.
Download SQL cheatsheet in PDF
Disadvantages Of Interpreter
Slower → Interpreter is often slower than compiler as it reads, analyzes and
converts the code line by line.
Dependencies file required → A client or anyone with the shared source code needs
to have an interpreter installed in their system, in order to execute the code.
Less Secure → Unlike compiled languages, an interpreter doesn’t generate any
executable file so to share the program with others we need to share our source
code which is not secure and private. So it is not good for any company or
corporations who are concerned about their privacy.

You might also like