2695Expt4-Macro Processor

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Experiment No.

4
Pass1 of Two-pass Macro Processor
Aim: Apply Two-pass Macro Processor algorithm to develop the macro processor and
generate MNT, MDT, ALA (for formal parameters and actual parameters), and Intermediate
code.
Software Requirement: Turbo C++ / Python /Java
Theory:
Macro represents a group of commonly used statements in the source programming language.
Macro Processor replaces each macro instruction with the corresponding group of source
language statements. This is known as the expansion of macros.
In Pass-I the macro definitions are searched and stored in the macro definition table and the
entry is made in macro name table.
In Pass-II the macro calls are identified and the arguments are placed in the appropriate place
and the macro calls are replaced by macro definitions.
SPECIFICATION OF DATABASES  for Pass 1:
 The input macro source program. 
 The intermediate code containing only macro call.
 Macro-Definition Table (MDT), to store the body of macro definitions.
 Macro-Definition Table Counter (MDTC), to mark next available entry MDT. 
 Macro- Name Table (MNT) - store names of macros.
 Macro Name Table counter (MNTC) - indicate the next available entry in MNT. 
 Argument List Array (ALA) - substitute index markers for dummy arguments before
storing a macro-definition.
Flowchart for Pass1:
Conclusion:
By analyzing the Pass1 flowchart of two-pass macro processor, and applying basic high-level
programming knowledge, we successfully simulated Pass1 of macro processor and generated
Macro Name Table (MNT), Macro Definition Table (MDT) and Argument List Array (ALA)
with Intermediate Code.
LOs achieved: LO2
POs achieved: PO1, PO2, PO3, PO4, PO8, PO10
PSOs achieved: PSO1

You might also like