The macro processor is system software. It is actually a program which is a part of the assembler program. The macro processor is designed in passes. In the design of the macro processor.

There are two important functions to be considered. They are given below.

  1. Saving the micro definition.
  2. Expanding the microcells.

These functions are done in the two passes. Here passes refers to reading the source program once. The function of each pass is given below.

Functions Of passes.

  • Read the source program.
  • If there is a macro call, stores the definition of macro in the macro definition table(MDT).
  • Starts the macro name in the macro name table(MDT).
  • Prepares the list of formal arguments list(AL) in the macro.
  • Repeats the similar processes for all the others macro.
  • Data structures are used in macro-processor design.

There is some important data structure used in the design of a macro processor.

They are:-

  1. Macro Name Table(MNT)
  2. Argument List(AL)
  3. Macro Definition Table(MDT)

1. Macro Name Table(MNT):-

It is a data structure which maintains the name and address (Pointers). Where the macro definition during the macro calls.

2. Argument List(AL):-

It also maintains the details about the format parameters. A list of formal parameters is indeed by some special symbols.



Here “R” and “S” are formal parameter and a special “&” is used to precode these parameters so as to indicates that these are formal parameters.

3. Macro Definition Table(MDT):-

It is also a data structure which keeps the macro body Ie:- Text. The macro body can be retrieved and used during the macro expansion by the macro processor. Whenever the macro definition is encountered the body is red and stored in the macro definition table(MDT). The function can be rewritten using the above-mentioned data structure given below.

The function of pass1 of the macro processor.

  • Create the macro name table(MNT) and macro definition table(MDT) during pass1.
  • Create a list of formal parameters Argument List(AL) in the macro name table.

The function of pass 2 of the macro processor.

  • During any macro call. Reads the macro body from the macro definition table(MDT) with the help of the Macro Name Table(MNT).
  • Extracts the formal parameters from the macro body and replace them by the actual parameters provided in the macro call.


Please enter your comment!
Please enter your name here