Design of a two-pass macro-processor.

Design of  2-pass Macro Processor

.

Video Tutorial


Design of two pass macro processors :-

Q.        Explain design of two pass MACRO processor in detail ?----(6m)

Ans. :- Macro processor takes a source program containing macro definitions and macro calls. It converts it into an assembly language program without macro definition or calls.

Design of two pass macro processors

Algorithm for pass 1 of macro processor :-

1) Initialize MNTC ( Macro Name Table ) Counter = 0 and MDTC ( Macro Definition Table

Counter ) = 0

2) Scanning of all macro definitions one by one . If MACRO found in program then for each macro perform:

3) MNTC = MNTC + 1 and enter name of MACRO in MNTC ( Macro Name Table ).

4) For every model statement MDTC = MDTC + 1 in definition of macro

5) Generate argument list array.

Algorithm for pass 2 of macro processor:-

1) Scan main program for macro call. For each macro call perform.

2) Scan MNT to detect Macro Name and its address in MDT ( Macro Definition Table ).

3) Replacement of all formal parameters by actual parameters.

4) Replace macro call by model statements from MDT.

Q.        Write contents of MNT,MDT and Argument list Array for following program .-----(6m)

MNT,MDT of macro processor
 

Argument list Array of MACRO array


Last modified: Friday, 20 September 2019, 12:35 AM