Which part interprets program instructions and initiates 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. Instead, an interpreter interprets program instructions by parsing them into source code and then converting the source code into an executable object code. An interpreter also executes compiled code produced by the compiler, and 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. This object code is linked to libraries at run time to make it executable by the interpreter.

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

Programming instructions are written in a high-level language, and the interpreter either directly executes it or transforms it into machine language that the CPU can execute. 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 executable blocks are identifiable in nature and relocatable in nature. The object code with a symbol table may also require other files to get executed. The linker is used to link these files; the linker links files required to generate executable code.

An interpreter written in one of the low-level languages contains code blocks generated using functions written in a 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, generates immediate instructions, and performs desired actions written in one of the high-level languages. An interpreter converts source code into machine code for 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 the case of the translator, this time is negligible as the interpreter translates only that part of the code that changes.

The binary code generated by the compiler is dependent on machine architecture, thus making it less efficient in terms of portability. A interpreted program 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 architecture-independent because interpreters interpret every statement each time source code is executed. An interpreter uses a lexical analyzer and parser to interpret the abstract syntax tree.

There exist 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 source code. The 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.

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

The Control unit takes the instructions and interprets them and works on the required operands, and produces the results. Therefore, 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 operations 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. For example, 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. Thus, 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. The 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. The control unit manages the instructions that manipulate memory.

The Control Unit of the Computer manages the 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.