Working Of. Python Engine:
Before we jump into working of python engine, let’s understand what is “Python” python is a high level programming language, which is widely used to give instructions to computer to perform different tasks.
Python engine acts as a translator between user and the computer to execute instructions given in python code.
Basically python engine is a complete system that processes and executes the python programs, all the components like interpreter, compiler, and python virtual machine .etc work together to execute a python code.
How does python engine work?
Think of python engine as a team workers. Each worker has a different job. They work together understand the code and make your computer to execute the program.
For example:
we want to add 2 numbers and we write a simple python code as
a = 10
b = 20
print( a+b )
output: 30
Get Taruvuchandana’s stories in your inbox
Join Medium for free to get updates from this writer.
But how does python produce the output? Lets see
What happens if we write the incorrect code?
For example:
a = 10
b = 20
print( a+b
Here we forgot the closing bracket.
. First the tokenizer breaks the code into small pieces.
. Parser checks the code and identify the syntax error.
. Python shows an error instead of executing the program.
Summary :
When we write a python code, “tokenizer” breaks the code into small pieces call tokens, “parser” checks wether code is following the python syntax or not, if the code is correct, it organises the code into structured tree called “AST” abstract syntax tree, than “compiler” will covert the structured code into byte code which is intermediate code understandable by “PVM” python virtual machine, PVM executes the byte code and gives us the output.





