When a program is written in another language, the machine language of the computer will not be able to understand it. A program written in another language must be translated into the computer's machine language before it can be executed. This kind of translation is done with help software.
"A program that translates an assembly language program into a machine language program is called an assembler." Assembler translates program written in assembly language called source code into machine code program called object code.
Keep in mind here that the code written in the assembly language is also called mnemonic code and the assembler comes under the category of system software, the assembler is divided into two parts on the basis of generating the code.
Self Assembler
Cross Assembler
01. Self Assembler
An assembler that runs on a computer for which it generates object code is called a self assembler. A less powerful and cheaper computer may not have sufficient software and hardware facilities for program development and convenient assembly.
02. Cross Assembler
If the assembler which runs on one computer and generates the machine code for the other computer then it is called cross assembler.
How does the assembler work?
After knowing what is called assembler, let us now know how it works, machine language is the language of 0's and 1's it means on or off which is very difficult to understand, friends, we are here for your information . Like ADD, MUL, DIV, SUB etc. These are also called symbolic codes, their use makes it easier to write programs.
This language was used before the advent of high level language, but nowadays there is a lot of high level language available in the market, so it is used very rarely, the program written using assembler in mnemonic code is called machine language. converts to. Which is easily understood by the computer, it is the work of the assembler.
It converts the mnemonic code of assembly language into machine code and completes this process of transformation in three steps. It first translates the source code into object code and then it converts the object code into object code with the help of linker program. translates into machine codes.
Opcode Table - This table collects and stores mnemonic codes. Which is the first step in the process of its translation.
Symbol Table - It serves to collect numerical data of the programming language used by the programmer.
Location Counter - It selects the location where those translated codes are to be installed.
Advantages of Assembler
Advantages of Assembler, Assembler hotly includes source code, pre-compiled code, and scripts, so programs do not need to be compiled. It is run directly.
For those who have knowledge of programming and who are just learning at the beginner level, it is very easy to use assembler as compared to translator.
When an error or error occurs in the program, they appear one by one in front of each line, which makes it very easy to solve the error.
It does the job of translating assembly language at a fast speed. Because its codes are already on low-level language.
It has knowledge of programming codes in both assembly and machine language. Due to which it works well.
It takes less time in its process and also it requires less storage to store its codes.
Assembler reads programming codes into different parts, due to which the chances of mistakes are greatly reduced.
With its use, we can give instructions to the computer in less time, but for this it is very necessary to have knowledge of assembly language.
It also automatically selects the location of the assembler storage and installs it at that place.
It is so safe that there is very little chance of its destruction.
Drawbacks of Assembler
It translates only one line at a time, due to which it takes time to translate the entire program.
It works slower than other translators like compilers.
Assembler is a good choice for development environments and programs. But it is not a good option for production.
Types of Assembler
The process that is completed by the assembler, by translating or translating the source code into object code, is divided into two parts, which perform different roles in different ways. Which work as follows-
One-Pass Assembler:- It works to translate assembly code directly into machine code in one go.
Two-Pass or Multi-Pass Assembler:- This program goes through various steps to translate. It splits the assembly code into opcodes and symbols before completing its translation process. After that it completes its task of converting it to machine code.
What is the difference between compiler and assembler?
Compiler | Assembler |
The compiler converts the source code written by the programmer into machine level language. | The assembler converts the assembly code into machine code. |
Compiler input source code. | Assembler inputs assembly language code. |
It converts the entire code into machine language at once. | But the assembler cannot do this in one go. |
A compiler is more intelligent than an assembler. | But, an assembler is less intelligent than a compiler. |
The compilation steps include lexical analyzer, syntax analyzer, semantic analyzer, code generator and error handler. | The assembler creates two phases on the given input, the first phase and the second phase. |
The compiler's output is a truncated version of the machine code. | The output of the assembler is binary code. |
C, C++, Java and C# are examples of compiler languages. | GAS is an example of GNU Assembler. |
Comments