What is an Interpreter in Computers?

Spread the love

An interpreter is a program which reads and executes the source code program line by line. It does not translate the source code into machine code. Therefore, an interpreter is also called program execution environment.

The designer of an interpreter goes through the source language, and makes a list of the the operations required to implement the language. For each identified operation/task, the designer writes a function. The main function of the interpreter is to read the source program line by line, and check the syntax/semantics. The parsed statement is executed through an appropriate function.

The program statements of the user program are executed by the interpreter, and not translation takes place. Therefore, an interpreter is always required whenever the program is executed. Since, each statement is interpreted on every execution of the program, the overall execution of the program becomes slow. Also memory consumption is more due to presence of interpreter in the memory.

For most of the new languages a interpreter is released first and then compiler.