0% found this document useful (0 votes)
17 views12 pages

Macro Processors: System Software

The document discusses macro processors and describes a single-pass macro processor algorithm. It includes details on the data structures and procedures used in the algorithm like main program, define, expand, and processline. Charts are also included comparing single-pass and two-pass macro processor design.

Uploaded by

gjaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views12 pages

Macro Processors: System Software

The document discusses macro processors and describes a single-pass macro processor algorithm. It includes details on the data structures and procedures used in the algorithm like main program, define, expand, and processline. Charts are also included comparing single-pass and two-pass macro processor design.

Uploaded by

gjaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Macro Processors

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

You might also like