Macro Processors
Chapter 4
System Software
An introduction to systems programming
Leland L. Beck
1
, Introduction
Concept
» A macro instruction is a notational convenience for the
programmer
» It allows the programmer to write shorthand version of a
program (module programming)
» The macro processor replaces each macro invocation with
the corresponding sequence of statements (expanding)
2
, Macro Processor
Recognize macro definitions
Save the macro definition
Recognize macro calls
Expand macro calls
Source
Macro Expanded Compiler or obj
Code
(with macro)
Processor Code Assembler
3
, Macro Definition
copy code
parameter substitution
conditional macro expansion
macro instruction defining macros
4
Chapter 4
System Software
An introduction to systems programming
Leland L. Beck
1
, Introduction
Concept
» A macro instruction is a notational convenience for the
programmer
» It allows the programmer to write shorthand version of a
program (module programming)
» The macro processor replaces each macro invocation with
the corresponding sequence of statements (expanding)
2
, Macro Processor
Recognize macro definitions
Save the macro definition
Recognize macro calls
Expand macro calls
Source
Macro Expanded Compiler or obj
Code
(with macro)
Processor Code Assembler
3
, Macro Definition
copy code
parameter substitution
conditional macro expansion
macro instruction defining macros
4