programming compiler vs interpreter code example

Example 1: interpreter vs compiler

A high level language(A language a machine and a human can understand),
include languages such as Java, Perl, C++, PHP, etc. C++ and Java are
"Compiled languages" because when you run the code, the IDE(Integrated Develope
ment Environment) will take all your 
syntax/program and convert it into a low level language
(Language a machine can understand but not human) by taking everything at once,
put for example: Perl and PHP, they are known as "Interpreter languages", as 
the IDE will read and convert every code one by one into binary code.
It is like you have to read all your books, and you are a compiler. You would go
and get all the books to your room first and then only you start reading them. 
If you were an interpreter, you would go and get one book, come back, read it, 
then go back and get another book, one by one. Hope you liked the explaination!

Example 2: compiler vs interpreter

# Interpreters and compilers are very similar in structure. 
$ The main difference is that an interpreter directly executes 
# the instructions in the source programming language while a 
# compiler translates those instructions into efficient machine code.

Tags:

Misc Example