Skip to main content

What is compiler? Give the difference between a compiler and an interpreter?

What is a compiler? Give the difference between a compiler and an interpreter?

Compiler:

i) A program which translates a high level language program into a machine level language program is known as a compiler.

ii) Compiler goes through the entire program and then translates the entire program into the machine code. (see fig I.)

compiler compiles into machine code
fig I Compiler compiles the program into the machine code

Image reference of the compiler, program and the machine codes

In the image the left side box entity is a compiler. The compiler shows the program you have written in the text editor or program editor compiles the whole program. The dotted line shown from the left side entity “the compiler” through the program just represents the compilation of the whole program. The dotted line also shows the program change into the machine code after the compiler compiles the whole program. These machine codes go to the ALU in the CPU that processes the codes and gives the instruction to the output units to perform a program output on the monitor.

iii) A compiler shows a list of errors along with the line numbers at the end of the program execution. (see fig. II)

compiler shows error after execution
fig II -Compiler shows error after execution of the program.

iv) The compiler is faster than the interpreter.
v) The object code program produced by the compiler is permanently saved for future reference.
vi) If the compiler runs on a computer for which it produces the object code it is known as a ‘self or resident compiler’.
vii) If a compiler runs on a computer other than that for which it produces an object code, it is known as a ‘cross compiler.

Interpreter:

i) An interpreter is a program which translates one state of a high level language program into machine code and executes it at a time (see fig III).

interpreter translate high level language into machine level language to check line by line errors.
fig III An interpreter check line by line errors in the program

ii) The interpreter shows errors line by line (see fig III).
iii) An interpreter is a smaller program as compared to the compiler.
iv) The object code of the statement produced by an interpreter is not saved.
v) The presence of a source program is always required for the interpreter.
vi) If the instruction is used next time, it must be interpreted once again and translated into the machine code.
vii) An interpreter needs less memory space.
viii) It can also be used in a smaller system with limited memory space
.

-----------------------------------------------------------------------------------------------------------------------------

My latest post is here links below about the databases technology

What are the components of data model in [DBMS] Relational Database Management System?

What is stability of the distributed database management system?

In the distributed database model there are.... 👉 click here👈

There are five main components of data model... 👉 click here ðŸ‘ˆ

Comments

Popular posts from this blog

Discuss the role played by the various components of the CPU

Q Discuss the roles played by the various components of CPU? The CPU is the brain of the computer system. All major calculations, manipulations and comparisons are made by the CPU. The CPU is also responsible for activating and controlling the operations performed by all other units of the computer system. The major components of the CPU are: a) Arithmetic Logic Unit (A.L.U.) b) Control Unit (CU) c) Primary Memory Arithmetic Logic Unit (A.L.U.): What is ALU Arithmetic logic Unit? ALU is a part of the CPU. It is a part to calculate the logical term in the CPU where the term refers to an operation of logical type. It also calculates the arithmetic terms in the CPU where the term refers to an operation of arithmetic type. It is used to direct access through the processor controller. The ALU connected to the input and output peripheral system through the bus with the different types of bus. Such as control bus, data bus etc. ALU is a part of the CPU that can calculate the input

About the memory and its Classification of the computer Memory

What are the memories in the reference of computer system? What is Computer Memory?:- The memory is the essential for the computer to store the data, instruction and information. Without memory, computers are not be able to store data, instruction etc. The memory is an essential part of a computer system. It is require by the computer system to store information. Memory can be divided into the following two categories types: i) Primary or Main memory ii) Secondary Memory or Permanent memory In this figure I'll show the classification of the memory of computer system peripheral and architecture of organisations Primary Memory or Main memory:- i) Primary memory is the memory which is fastest memory of the computer. ii) It is a small but relatively fast storage unit that stores data and instruction which are used by the CPU (central processing unit). iii) This type or category of a memory is the main memory of the computer.It is a temporary memory and also we

What are the three main purpose of an operating system?

What are the three main purpose of an operating system? There are three main purpose of an operating system. 1. The first main purpose is User interface between hardware and users. 2. The second main purpose is to operate the internal parts of the computer properly and systematically using binary code system in the form of 0 and 1. 3. The third main purpose is to provide an environment for development of an application software and program to uses the hardware resources of the computer and connected to the computer parts which provides output to the user, the output from application software is very useful for users. Interface between user and hardware device  The operating system uses all types of interface such as command line interface, batch command interface and Graphical User Interface to interact with users to hardware peripheral devices through the monitor screen. Monitor has a big role making interface between hardware and users. Monitor visualization of all types of o