Single Pass Macroprocessor

Topics: C, Parameter, Definition Pages: 3 (488 words) Published: February 22, 2013
Lecture notes of Single pass Macro processor dated 21.01.2013

Design of a single pass macro processor

I) Rule
This design is based on the rule that all macro definitions should appear at the beginning of the program.

II) Format of defining a macro
The format for defining a macro is as follows:
MACRO(macro keyword
……………………………..(macro prototype

……………………………………….(start of macro body ……………………………………….
……………………………………….
……………………………………….(end of macro body

MEND(end of macro definition
Example:

[pic]

Format of database of a single pass macro processor (Data structures used by a single pass macro processor)

A) Macro Name Table (MNT)
|Macro name |MDTP |#PP |#KP |KPTP |#EVS | | | | | | | |

i) MNT is used for storing the macro names along with MDTP which indicates the location in MDT where the corresponding definition is stored. ii) MNT keeps track of the number of PPs and KPs for error handling. iii) MNT maintains a pointer to KPT called KPTP.

iv) MNT also keeps track of the number of expansion variables required by the macro.

B) Macro Definition Table (MDT)
|Macro definition |
| |

i) MDT is used for storing the macro definitions along with MEND statement. ii) While storing the definition, the parameters and expansion variables are replaced by #n and EV#n respectively. iii) While performing macro expansion, #n and EV#n would be replaced by their values from APL and EVS respectively.

C) Keyword Parameter Table (KPT)
|Keyword...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • single Essay
  • To Pass or Not to Pass Essay
  • Single Essay
  • Essay about single
  • single Essay
  • Pass Laws Essay
  • Design of a Polystyrene Plant for Differing Single Pass Conversions Essay
  • pass paper

Become a StudyMode Member

Sign Up - It's Free