Consider the following statements for a simple assembler : 1. It scans the entire assembly program twice, where each scan is called a pass. 2. It generates a table that includes all symbols and their binary values. 3. It will use the symbol table and other tables to generate the object program and output some information that will be needed by the linker. Which of the above statements are correct ?
Consider the following statements for a simple assembler : 1. It scans the entire assembly program twice, where each scan is called a pass. 2. It generates a table that includes all symbols and their binary values. 3. It will use the symbol table and other tables to generate the object program and output some information that will be needed by the linker. Which of the above statements are correct ? Correct Answer 1, 2 and 3
The correct answer is option 4.
- Assemblers are programs that generate machine code instructions from a source code program written in assembly language. The assembler will replace symbolic addresses by numeric addresses, replace symbolic operation codes by machine operation codes, reserve storage for instructions and data, and translate constants into machine representation.
- The functions of the assembler can be performed by scanning the assembly program and mapping its instructions to their machine code equivalent.
- Since symbols can be used in instructions before they are defined in later ones, a single scanning of the program might not be enough to perform the mapping. A simple assembler scans the entire assembly program twice, where each scan is called a pass.
- During the first pass, it generates a table that includes all symbols and their binary values. This table is called the symbol table.
- During the second pass, the assembler will use the symbol table and other tables to generate the object program, and output some information that will be needed by the linker.
- The assembler uses at least three tables to perform its functions: symbol table, opcode table, and pseudo instruction table. The symbol table, which is generated in pass one, has an entry for every symbol in the program. Associated with each symbol are its binary value and other information.
Hence, statements 1,2 and 3 are correct.
মোঃ আরিফুল ইসলাম
Feb 20, 2025