Page 103 - DCAP507_SYSTEM_SOFTWARE
P. 103

Unit 7: Macro Language




              Defining MACROS or MACROX does not define RDBUFF and the other macroinstructions.  Notes
               These definitions are developed only when an invocation of MACROS or MACROX is
               expanded.
              A one pass microprocessor that can swap between macro definition and macro expansion
               is able to manage macros like these.

              There are three main data structures included in our macro processor.

          Definition Table (DEFTAB)

          1.   The macro definition themselves are accumulated in definition table (DEFTAB), which
               comprises the macro prototype and statements that make up the macro body.
          2.   Comment lines from macro definition are not entered into DEFTAB since they will not be
               a part of macro expansion.

          Name Table (NAMTAB)

          1.   References to macro instruction parameters are transformed to a positional entered into
               NAMTAB, which provides the index to DEFTAB.

          2.   For every macro instruction defined, NAMTAB comprises pointers to beginning an end of
               definition in DEFTAB.

          Argument Table (ARGTAB)

          1.   The third Data Structure in an argument table (ARGTAB), which is utilized throughout
               expansion of macro invocations.
          2.   When macro invocation statements are predictable, the arguments are amassed in ARGTAB
               according to their position in argument list.

          3.   As the macro is expanded, arguments from ARGTAB are replaced for the corresponding
               parameters in the macro body.


































                                           LOVELY PROFESSIONAL UNIVERSITY                                   97
   98   99   100   101   102   103   104   105   106   107   108