Which part Interprets Program Instructions?

A computer program called Interpreter is responsible for the execution of the program instructions. An interpreter interprets program instructions without compiling them into machine instructions. An interpreter interprets program instructions by parsing it into source code and then converting the source code into an executable object code. An interpreter also executes compiled code produced by the compiler, this compiled code is also part of the interpreter.

The program instructions which are also called source code are compiled and converted into object code which is machine independent and this object code is linked to libraries at run time to make it executable by interpreter.

Interpreter is a program using which most of the programming instructions are executed as interpreter translates programming instructions into executable code.

Programming instructions are written in high-level language and the interpreter either directly executes it or transforms it into machine language that can be executed by the CPU. A compiler is a program that produces executable object code. This object code is machine specific and contains a symbol table. Using this object code and symbol table, executable blocks are created. These execurtable blocks are identifiable in nature and relocatable in nature. The object code with symbol table may also require other files to get executed, to link these files linker is used, the linker is a program that links files required to generate executable code.

An interpreter which is written in one of the low-level languages contains code blocks generated using functions written in high-level language; these code blocks get executed when a look-up table entry calls it.

An interpreter generates a parse tree using source code and in turn generates immediate instructions and performs desired actions written in one of the high level languages. An interpreter converts source code into machine code for each and every instruction that will get executed. Most of the interpreter comes with an inbuilt editor

When a program’s instructions undergo changes, the compiler translates the whole source code again and links all the files again to generate executable code blocks, time taken to do all this process is not negligible and if the source code is large then this time becomes noticeable. But in case of translator this time is negligible as the interpreter translates only that part of the code that undergoes change.

The binary code generated by the compiler is dependent on machine architecture thus making it less efficient in terms of portability. A program that is interpreted can be distributed easily as it is machine architecture independent but the interpreted program execution time is low. An interpreter is generally slow against compiler this is because interpreters interpret each and every statement each time source code is executed. An interpreter uses lexical analyzer and parser to interpret the abstract syntax tree.

There exists different types of interpreters such as Bytecode Interpreter, Threaded Code Interpreter, Abstract Syntax Tree Interpreters, Template Interpreter, Self-Interpreter and Computer Processors.

Bytecode Interpreters are those that interpret Bytecode. There exists a high level language that compiles source code into bytecode. This bytecode is not machine readable thus it must be made machine readable to make it machine readable Bytecode Interpreters are used. Threaded Code Interpreters are the same as Bytecode Interpreters the difference is that in place of bytes pointers are used.

In Threaded Code Interpreter each instruction is denoted by a word and each word points to a function and these functions contain the fetch and jump instruction to go to the next instruction.

Abstract syntax tree interpreters translate the source code into an abstract syntax tree; this abstract syntax tree is used to execute the program. In Abstract Syntax Tree Interpreter each programming instruction is parsed once.

Template Interpreter manages a large sequence of bytecodes and this bytecode is mapped into its respective machine instructions and these machine instructions are executed on the target machine using the key value pairs known as “Template”.

Self-Interpreter is in itself a programming language and is capable of interpreting its own source code, BASIC language is an example of self-Interpreter. Interpreter of BASIC is written in BASIC language.

Computer processors can also parse the source code written in a language such as VHDL and execute it. Thus computer processors also act as Interpreters.

The control unit belongs to the central processing unit that is responsible for the operations of the processor. A control unit consists of a binary decoder that translates the coded instructions into control signals.

Control unit is responsible for maintaining and managing most of the computer resources. The control units maintain streams that manage the data flow between CPU and other connected devices. The control unit is an inbuilt unit of the central processing unit.

Control unit takes the instructions and interprets it and works on the required operands and produces the results. It can be said that the control unit controls the computer. The control unit also contains a binary counter that controls the logic of the unit. There also exists a control unit which is a multicycle control unit.

A multicycle control unit works in both rising and falling clock time. This control unit performs operation on each edge of the timing clock. Due to this type of process, a multicycle control unit can carry out four-step operations in two clock cycles.

Control units also handle interrupts. The control unit can stop the current process and handle the interrupt. The process that is abandoned is restarted when the control is returned from the interrupt. It is also possible that control first completes the current program execution and then handles the interrupt.

Computers also use pipelined processing. Pipeline processing has a high speed execution cycle. The pipelined control units store the result of each stage to be used in the next stage. Pipelined control units manage the start, continue and stop of a program. The pipelined control unit manipulates the data in each stage and then transfers the result to the next stage. The pipelined control unit ensures that instructions of one stage do not affect the instruction of another stage and thus deliver the correct result.

A control unit is also capable of maintaining a list of the most recently visited branches and this list contains encoded branch instruction addresses. This list maintains the record of the most recently traversed part of the tree.

The Control Unit is capable of executing many instructions at the same time, this is done by arranging these instructions. The computer executes many instructions per clock cycle.

A control unit also translates the complex instruction into multiple simple instructions. The main advantage of this is that computers can implement complex multi-step instructions. Control unit is also responsible for managing power usage that enlarges the battery life of computers.

At present all central processing units have inbuilt control logic units. Control unit manages the instructions that manipulate memory.

The control Unit of the Computer manages data flow of the CPU to correct instructions. Thus the control unit can execute the whole program without human intervention. Control units can also be implemented using combinational logic units that are known as hardwired control units. The hardwired control units have countable gates that can be used to generate desired results. The control units that are hardwired are faster.