Module2 Assembler
Module2 Assembler
Module-2
Why We Need Translator?
Machine-Opcode
Table (MOT) or This table consists of the fields:
(Operation Code Name of mnemonic, binary
Table) or value, instruction length, format
Mnemonics Table of instruction.
During the first pass, it reads the entire source code and builds a symbol
table that contains information about all labels and their addresses.
In the second pass, it generates the machine code using the information
collected in the first pass.
• Two Pass Translation
▪ It can handle forward references
easily.
▪ LC processing is performed in
the first pass and symbol
Pass defined in the program are
Structure of entered into the symbol table.
▪ The second pass synthesizes the
Assembler target form using the address
information found in the symbol
table.
▪ In effect, the first pass performs
analysis of the source program
while the second pass performs
synthesis of the target program.
Two-Pass Assembler
Data
Structure
for Pass-1
Data
Structures
of
assembler
Pass I
Pass II of an assembler
Data Structure for Pass-2
Pass II of an assembler
Pass II of an assembler
• Both types of assemblers have their own
advantages and disadvantages.
▪ Single-pass assemblers are faster but
less flexible, while multi-pass
assemblers are more flexible but
slower.
▪ The choice between the two depends
on the specific requirements of the
Advantages and program being assembled.
Disadvantages ▪ For example, if speed is a priority and
all symbols are defined before, they
are used, a single-pass assembler
would be the better choice.
▪ If flexibility is more important, or if
symbols are used before, they are
defined, a multi-pass assembler would
be more suitable.