1.6 – Compiler vs Interpreter

How Computer Understand Instructions?

Computer does not understand English nor it understand the mouse clicks.

Computer only understands 1 and 0 language. ON or OFF. That’s how the instructions are given to machine.

Machine Language or Assembly language are the languages that converts the instructions into the code that machine understands.

But the language that we learn like Java, C or PHP are just plain English and use words like If, then, switch with some symbols to give instructions.

So, there has to be some kind of conversion from our English Language to Machine Language.

That is the job of Compiler and Interpreter which helps to convert the English language into machine language that computer can understand.

What is Compiler?

Compiler is a program that read our program and converts them into machine language. Then that compiled code is executed to give instructions to the machine.

Without compiling our code, we cannot execute our code.

Programming Language like Java and C uses compiler to compile its code into another file that is used to execute on the system.

What is Interpreter?

Interpreter is a program that executes our code at runtime and pass the instructions to the computer at the same time.

It does not generate another set of files and execute them but instead it reads our program line by line and then execute them in the same sequence.

Languages like PHP and Ruby uses Interpreters.


Leave a Comment