B.2 Assemblers

Jobs to be done by an assembler: An assembler has to do the following at the minimum:

  1. Scan the input assembly language code, check that only valid characterset is used and statement constructs are valid.
  2. Replace all mnemonic op-codes by correct machine op-codes.
  3. Replace all symbolic addresses, address constants, etc. by proper numeric values.
  4. Assign data areas and provide for loading-defined data wherever specified.
  5. Execute all the other pseudo-operations.

We shall now consider various types of assemblers and their major characteristics. We then discuss working of a two-pass assembler for the example assembly language.

Types of Assemblers

  • Line-by-line assembler: This type of assembler is usually used in debuggers, where the ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.