written 2.0 years ago by |
Solution:
What is an Interpreter?
An interpreter is a program that directly executes the instructions at a high-level language, without converting it into machine code.
In programming, we can execute a program in two ways. Firstly, through compilation and secondly, through an interpreter. The common way is to use a compiler.
Any software by which the conversion of high-level instructions is performed to machine-level language, known as an interpreter.
How python interpreter works:
The python code you write is compiled into python byte code, which creates a file with the extension “.py-file”.
The byte code compilation happened internally and was almost completely hidden from the developer.
The compilation is simply a translation step, and byte code is a lower-level, and platform-independent, representation of your source code.
This byte code translation is performed to speed execution so byte code can be run much quicker than the source code statements.
The .py-file, created in the compilation step, is then executed by the appropriate virtual machines.
The Virtual Machine is just a big loop that iterates through your byte code instructions, one by one, to carry out their operations.