Thursday, August 31, 2023

What is Compiler and Interpreter ?

Both Compiler and Interpreter are program source code(High Level Language) into machine code(Low Level Language).


COMPILER

  • A Compiler takes the entire Program in One go.
  • The Compiler generates an Intermediate Object Code.
  • Compiler Converts high-level program that Can be executed many times
  • Error are displayed after entire program is Checked.
  • High Memory Required.
  • Compiler is used by C, C++, C#, Java


INTERPRETER 

  • An Interpreter takes a Single line Code at a time.
  • The interpreter never produces any intermediate object Code!
  • Interpreter Convert high level program each time it is executed.
  • Errors are displayed line by line.
  • Less memory required.
  • Interpreter used by python, PHP, Ruby ek




When we execute any python program, Internally two phases took place.

1) COMPILATION PHASE

2) Execution phase


1) COMPILATION PHASE :

  • The python compiler, reads the Source code line by line and Converted into intermediate Code of python Called "Byte Code"
  • Since python compiler converting the Source code into byte code line by line hence it is interpreted.



2) EXECUTION PHASE :

  • The PVM (Python virtual Machine) reads line by line of byte Code and Converted into machine understandable Code and it is read by Operating system and processor and gives final result of the program. 





No comments:

Post a Comment