What is Compiler?
The
processor executes object code, which indicates when binary high and low
signals are required in the arithmetic logic unit of the processor.
Explain
C++ is
high-level language. A high-level programming language understandable by us
humans. Its words and phrases similar to English or other human language. But a
computer does not understand high-level programming language that ate readable
for human. Computer understands only binary language that are based on 1’s and
0’s, it is called the machine code.
A
program written in high-level programming language is called a source code. If
we want to convert source code into machine code then we need a Software,
called compiler or Interpreter that convert high
language to machine language
What is Difference between Compiler and
Interpreter?
Compiler
|
Interpreter
|
|
Techniques
|
Convert entire program
to machine language
|
Convert
program one statement at a time into machine language
|
Examples
|
C /
C++ languages
use compiler
|
Ruby
, Python, Basic use Interpreter
|
Speed
|
Compiler
is Faster than interpreter
|
Interpreter
is slower than compiler
|
Debugging
|
Errors
check on Entire program
|
Errors
check on Line By Line of program generated
|
Memory
|
More
memory due
to object code is generated
|
Use less
memory due to no intermediate object code
|
A compiler executes four
major steps:
Scanning:
In
Compiler scanner phase, it reads one character at a time from the source code
and keeps track of which character is present in which line.
Lexical Analysis:
In
Compiler Lexical Analysis phase, it converts the sequence of characters that
appear in the source code into a series of strings of characters known as
tokens.
Syntactic Analysis:
In
Compiler Syntactic analysis phase, it is performed, which involves
preprocessing to determine whether the tokens created during lexical analysis
are in proper order as per their usage.
Semantic
Analysis:
There
are following top Compiler list for C++.
- Borland C++ / Turbo C++ [Old and most popular IDE]
- Visual C++ [Microsoft Platform]
- Dev C++
- GCC
- Eclipse