Introduction to Python Programming – Interpreter

You can learn about Introduction to Programming Using Python Programs with Outputs helped you to understand the language better.

Introduction to Python Programming – Interpreter

Interpreter

An interpreter is a program that translates the state¬ments of a high-level language program into machine code. It translates one statement of the program at a time. It reads one statement of a high-level language program, translates it into machine code, and executes it. Then, it reads the next statement of the program, and again translates and executes it. In this way, it proceeds further till all the statements of the program are translated and executed. On the other hand, the compiler goes through the entire high-level language program once or twice and then translates the entire program into machine codes, A compiler is 5 to 25 times faster than an interpreter.

The object program produced by the compiler is permanently saved for future reference. On the other hand, the object code of the statement produced by the interpreter is not saved. If an instruc¬tion is used the next time, it must be interpreted once again and translated into machine code. For Module 3: M3-R5

For example, during the repetitive processing of the steps in a loop, each instruction in the loop must be re-interpreted as the loop is executed. Interpreter, unlike the compiler, does not generate any intermediate code; it directly executes program statements line-by-line. Note that Python supports interpreters, so programs are executed directly. (See Figure 1.6).

  • An interpreter is a small program as compared to a compiler. It occupies less memory space, so it can be used in a smaller system that has limited memory space.

Python is an interpreter language. It means it executes the code line by line. Python provides a Python Shell (also known as Python Interactive Shell) which is used to execute a single Python command and get the result.

Leave a Reply

Your email address will not be published. Required fields are marked *