What is Compiler ?
C is a middle or low level language programming language. So we need to convert this into binary language . To convert high level language into low level or binary language we need Translators.- Compiler is a translator ,which translate a program written in high-level language into binary language (machine language).
- Compiler translate the entire source program into object program at once.
- In compiler , intermediate object code is generated , condition control statements are execute faster.
What is Interpreter ?
Interpreter translate a program written in high -level language into machine language. And it is also involved in its execution.
- Interpreter translate entire source of program into object program line by line and immediately executes.
- It takes single instruction as input, there is no intermediate object code is generated.
- In interpreter memory requirements is Less.
- Every time interpreter convert higher level program into lower level program.
Example:- BASIC
Difference Between compiler and interpreter
S.NO. COMPILER INTERPRETER 1 Compiler Takes Entire program as input . Interpreter Takes Single instruction as input. 2 Intermediate Object Code is Generated.. No Intermediate Object Code is Generated. 3 Conditional Control Statements are Executes faster. Conditional Control Statements are Executes slower. 4 Memory Requirement: More(Since Object Code is Generated). Memory Requirement is Less. 5 Program need not be compiled every time. Every time higher level program is converted into lower level program 6 Errors are displayed after entire program is checked Errors are displayed for every instruction interpreted (if any) 7 Example:C Compiler Example: BASIC
Role of Compiler
- Compiler reads the source code, outputs executable code
- Translates software written during a higher-level language into instructions that computer can understand. It converts the text that a programmer writes into a format the CPU can understand.
- The process of compilation is relatively complicated. It spends a lot of time analyzing and processing the program.
- The executable result's some sort of machine-specific code .
Role of Interpreter
- The interpreter converts the source code line-by-line during RUN Time.
- Interpret completely translates a program written during a application-oriented language into machine level language.
- Interpreter allows evaluation and modification of the program while it's executing.
- Relatively less time spent for analyzing and processing the program.
- Program execution is relatively slow compared to compiler.
0 Comments