Macro Processors: System Software
Macro Processors: System Software
Chapter 4
System Software
An introduction to systems programming
Leland L. Beck
1
Data Structures
● 1. DEFTAB
● 2. NAMTAB
● 3. ARGTAB
2
3
● Algorithm uses 5 procedures
1. Main program
2. DEFINE
3. EXPAND
4. PROCESSLINE
5. GETLINE
4
PROGRAM EXPANDED PROGRAM
SUM MACRO &X,&Y START
LDA &X LDA 4500
ADD B
MOV B
.SUM P,Q
LDA &Y LDA &P
ADD B MOV B
MEND LDA &Q
START ADD B
LDA 3000
LDA 4500
………
ADD B .SUM M,N
SUM P,Q LDA &M
LDA 3000 MOV B
……… LDA &N
SUM M,N ADD B
……..
……..
END
END 5
9
1-Pass Macro Processor
If macro definition
l If normal code
c al
cro
m a
If Write to output
file
10
Comparison of Macro Processors Design
● Single pass
» every macro must be defined before it is called
» one-pass processor can alternate between macro definition
and macro expansion
» nested macro definitions may be allowed but nested calls
are not
● Two pass algorithm
» Pass1: Recognize macro definitions
» Pass2: Recognize macro calls
» nested macro definitions are not allowed
11
12