This document defines macros and describes how macro processors work. It states that a macro is a notation for program generation through expansion. A macro represents commonly used groups of statements that are substituted for the macro invocation. The macro processor replaces each macro invocation with the corresponding group of statements from the macro definition. It then discusses the basic functions of a macro processor, including macro definition using directives, macro invocation, and expanding invocations by substituting arguments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100%(1)100% found this document useful (1 vote)
5K views
Macros and Macro Processors
This document defines macros and describes how macro processors work. It states that a macro is a notation for program generation through expansion. A macro represents commonly used groups of statements that are substituted for the macro invocation. The macro processor replaces each macro invocation with the corresponding group of statements from the macro definition. It then discusses the basic functions of a macro processor, including macro definition using directives, macro invocation, and expanding invocations by substituting arguments.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6
Chapter 5
Definition : Macro is a unit of specification for
program generation through expansion. A macro instruction (abbreviated to macro) is simply a notational convenience for the programmer. A macro represents a commonly used group of statements in the source programming language Expanding a macros Replace each macro instruction with the corresponding group of source language statements Expanded program A program with Macro A program without Macro definitions and Processor Macro definitions Macro invocations
Assembler
Object program Macro Definition Basic macro processor Functions
Two new assembler directives
MACRO MEND
A pattern or prototype for the macro
instruction Macro name and parameters See figure 5.1 Macro invocation Often referred to as a macro call Basic macro processor Functions
Need the name of the macro instruction begin
invoked and the arguments to be used in expanding the macro Expanded program Figure 5.2 No macro instruction definitions Each macro invocation statement has been expanded into the statements that form the body of the macro, with the arguments from the macro invocation substituted for the parameters Macro invocations in the prototype and subroutine calls are different Note also that the macro instructions have been written so that the body of the macro contains no label Why? Imagesof pass I and Pass II along with the example from book