SlideShare a Scribd company logo
MACRO LANGUAGE &
MACRO PROCESSOR
Prepared by
Mrs. Saranya V, M.Sc., M.Phil.
Assistant Professor,
BCA Dept.,
TICM
CONTENT
 MACRO LANGUAGE AND THE MACRO
PROCESSOR: Macroinstruction, Features of macro
Facility, Macro instruction arguments, conditional
macro Expansion, macro calls within macros,
macro Instructions defining macros,
Implementation, Statement of problem,
implementation of a restricted facility, A two pass
algorithm. A single pass algorithm, implementation
of macro calls within macros. Implementation within
an assembles.
2
Mrs.
Saranya
V,AP/BCA,TICM
MACRO INSTRUCTIONS
 Sometimes need to repeat some blocks of code
several times in our program/task. In such cases to
avoid this repetition the system software provides us
with special component i.e., MACRO
 Macro instructions is a notational convenience for the
programmer that it allows the programmer to write a
short hand version of a program
Source code
(with macro)
Macro
processor
Expanded
code
Object
code
Compiler or
Assembler
3
Mrs.
Saranya
V,AP/BCA,TICM
MACRO
 Macro instructions are single line abbreviations for
group of instructions.
 Using a macro, programmer can define a single
“instruction” to represent blockof code.
 The design of macro processor is generally
machine independent.
 Every programming language will be using the
macro processor
4
Mrs.
Saranya
V,AP/BCA,TICM
MACRO PROS & CONS
Advantage:
 The frequent use of macros can reduce programmer-
induced errors.
 A macro allows to define instruction sequences that are
used repetitively throughout the program.
 The scope of the symbol is limited to that macro only.
Disadvantage:
 The size of the program is little higher. The reason is,
the pre-processor will replace all the macros in the
program by its real definition prior to the compilation
process of the program. 5
Mrs.
Saranya
V,AP/BCA,TICM
MACRO VS SUB-ROUTINE
 Used when maximum
processor speed is
required.
 Used when amount of
memory consumed is
less important.
 Each invocation includes
the assembly code
associated with the
macro in-line
 Speeds up the execution
of algorithm
 Should be used when
certain procedures are
frequently executed.
 Used when use of
memory must be kept
minimum.
 Each invocation requires
only the code necessary
to call subroutine
 Program size can be
reduced
Macro Sub-routine
6
Mrs.
Saranya
V,AP/BCA,TICM
MACRO-PROCESSOR FUNCTIONS
There are 3 main functions of macro processor. They
are
 1. Macro definition
 2. Macro calls or invocation
 3. Macro expansion
7
Mrs.
Saranya
V,AP/BCA,TICM
MACRO DEFINITION
 Macro definition attaches a name to a sequence of
instruction/operations
 Structure of macro-definition
MACRO starting of macro definition
[ ] macro_name
…………….
……………. sequence of instruction
…………….
MEND ending of macro definition
8
Mrs.
Saranya
V,AP/BCA,TICM
MACRO DEFINITION(CONTD..)
 The macro definition starts with MACRO pseudo op code.
 It indicates beginning of the macro definition.
 The Macro-definition terminated with the MEND pseudo op
code.
A 1, data
A 2, data
A 3, data
…..
…..
A 1, data
A 2, data
A 3, data
…..
…..
A 1, data
A 2, data
A 3, data
…..
…..
Data DC f „5‟
9
Mrs.
Saranya
V,AP/BCA,TICM
MACRO DEFINITION(CONTD..)
 In the above example the sequence of
A 1, data
A 2, data
A 3, data
 It repeats 3 times MACRO permits as to attach a name to this
sequence and to use the name in its place then the macro definition
will be
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
 MACRO=> is a pseudo op indicates beginning of definition
 Add => is the name of the macro
 MEND => is a pseudo op indicate end of the macro definition
 Between the name of the Macro Add and MEND we have the
sequence of instruction.
10
Mrs.
Saranya
V,AP/BCA,TICM
MACRO CALLS OR INVOCATION
 Once the macro has been defined, the use of the macro
name as an operation mnemonic in an ALP is equivalent
to corresponding instruction sequence
 Sequence of instruction are simply substituted at the
point of call or macro name is referred as macro call
 In the above mentioned example sequence will be
repeated thrice, then we need to replace sequence by
macro name like:
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
So, the main program looks like
…….
Add
……
Add
……
Data DC f „5‟
11
Mrs.
Saranya
V,AP/BCA,TICM
MACRO EXPANSIONS
 Whenever the program needs the instruction in the place of
macro name then we need macro expansion.
 The macro-processor replace each macro calls with the
defined set of instructions. This process of replacement is
called macro expansion.
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
…….
Add
……
Add
……
Data DC f „5‟
A 1, data
A 2, data
A 3, data
A 1, data
A 2, data
A 3, data
Does not appear
Expanded Program
Source Program
12
Mrs.
Saranya
V,AP/BCA,TICM
Input File
Macro names
Macro
definitions
Scan file for macros
Extract macros with
name and definition
Scan for macro names
Replace macro name with
Corresponding definition
Processed
File
Block Representation of Macro Expansion
13
Mrs.
Saranya
V,AP/BCA,TICM
FEATURES OF MACRO FACILITY:
 There are mainly 4 important feature of macro.
They are
1. Macro instruction argument
2. Conditional macro expansion
3. Macro calls within macros
4. Macro instruction defining macros
14
Mrs.
Saranya
V,AP/BCA,TICM
MACRO INSTRUCTION ARGUMENT
 To overcome lack of flexibility problem, we use macro
instructions arguments where these arguments are
appears in macro call.
 The corresponding macro dummy arguments are
appears in macro definition.
 Eg: A 1,data1
A 2,data2
A 3,data3
:
A 1,data3
A 2,data2
A 3,data1
:
data1 DC F‟5‟
data2 DC F‟6‟
15
Mrs.
Saranya
V,AP/BCA,TICM
Source
MACRO
INCR &arg (Macro name with
A 1,&arg one argument)
A 2,&arg
A 3,&arg
MEND
:
:
INCR data1 (use of data1 as
: operand)
:
INCR data 2 (use of data1 as
: operand)
data1 DC F’5’
data2 DC F’6’
:
END
F’6’
Expanded Source
:
:
:
:
:
A 1,data1
A 2,data1
A 3,data1
:
A 1,data2
A 2,data2
A 3,data2
:
:
data1 DC F’5’
data2 DC
MACRO INSTRUCTION ARGUMENT(CONTD..)
16
Mrs.
Saranya
V,AP/BCA,TICM
MORE THAN ONE ARGUMENT IN MACRO CALL
Source
MACRO
INCR & arg 1, & arg 2, & arg 3,& lab 1
& lab1 A 1, &arg1
A 2, &arg2
A 3, &arg3
MEND
:
:
:
LOOP1 INCR data1, data2, data3
:
:
:
LOOP2 INCR data3, data2, data1
:
:
data1 DC F ‘5’
data2 DC F ‘6’
data3 DC F ‘7’
Expanded source
:
:
:
:
:
:
:
:
LOOP 1 A 1, data 1
A 2, data 2
A 3, data 3
:
:
LOOP 2 A 1, data3
A 2, data2
A 3, data1
:
data1 DC F ‘5’
data2 DC F ‘6’
data3 DC F ‘7’
17
Mrs.
Saranya
V,AP/BCA,TICM
TWO WAYS OF SPECIFYING
ARGUMENTS TO A MACRO CALL
 Positional argument
 Argument are matched with dummy arguments
according to order in which they appear.
Eg:INCR A,B,C
“A‟ replaces first dummy argument
“B‟ replaces second dummy argument
“C‟ replaces third dummy argument
18
Mrs.
Saranya
V,AP/BCA,TICM
TWO WAYS OF SPECIFYING
ARGUMENTS TO A MACRO CALL(CONTD..)
 Keyword Argument
 This allows reference to dummy arguments by
name as well as by position.
e.g.
INCR &arg1 = A,&arg3 = C, &arg2 =‟B‟
(Or)
INCR &arg1= A, &arg2 = B, &arg2 =‟C‟
19
Mrs.
Saranya
V,AP/BCA,TICM
CONDITIONAL MACRO EXPANSION
 This allows conditional selection of machine
instructions that appear in expansion of macro call.
 The sequence of macro expansion can be reordered
or change based on some conditions.
 There are 2 Important macro processor pseudo op.
they are
AIF
AGO
20
Mrs.
Saranya
V,AP/BCA,TICM
AIF
 It is a conditional branching pseudo op the format of AIF
is
AIF<expression>.<sequencing label>
 Where expression is a relational expression, it involves
strings, numbers etc.
 If the expression evaluates to true them the control
transferred to the statements containing the sequencing
label
 Otherwise, the control transferred to the next statement
followed by AIF
 AIF statement does not appears in the expanded source
code
21
Mrs.
Saranya
V,AP/BCA,TICM
AGO
 It is an unconditional branching pseudo op the format of
AGO is
AGO.<Sequencing label>
 It is conditional transfer control to the statement containing
sequencing label
 Each and every label must be starting with a .(dot)
operator.
 AGO statement does not appear in the expanded source
code.
Ex:
Loop1 A 1,data1
A 2, data2
A 3, data3
Loop2 A 1,data3
A 2, data2
Loop3 A 1, data1
22
Mrs.
Saranya
V,AP/BCA,TICM
FINI
 FINI is a macro label.
 Labels starting with a period(.) such as .FINI, are
macro labels and don't appear in the output of the
macro processor.
AIF (& COUNT EQ 1).FINI
 It directs the macro processor to skip to
statement labeled FINI if the parameter
corresponding to & COUNT is 1,otherwise
the macroprocessor continues with the
statement following the AIF pseudo-op
23
Mrs.
Saranya
V,AP/BCA,TICM
CONDITIONAL MACRO EXPANSION(CONTD..)
Source Program
MACRO
& arg0 INCR & count, & arg1, & arg 2, & arg3
& arg0 A 1, &arg1
AIF (& Count EQ.1). FINAL
A 2,& arg2
AIF (&count EQ 2). FINAL
A 3, &arg3
.FINAL MEND
:
LOOP1 INCR 3, data1, data2, data3
:
:
LOOP2 INCR 2, data3, data2
:
LOOP3 INCR 1, data1
:
data1 DC ‘5’
data2 DC ‘6’
data3 DC ‘7’
Expanded Program
LOOP1 A 1, data1
A 2, data2
A 3, data3
LOOP2 A 1, data3
A 2, data2
:
LOOP3 A 1, data1
:
data1 DC ‘5’
data2 DC ‘6’
data3 DC ‘7’
:
24
Mrs.
Saranya
V,AP/BCA,TICM
MACRO CALLS WITHIN THE MACROS
 Macro calls can be called only after being defined. Sometimes
one macro will call another macro such a concept is called
macro calls
 “Macro can be called within the definition of the another macro
this is also referred as nested macros”
 The definition of called macro should appear before the macro
definition which contains the macro call.
Macro
ADD1 &argL 1,&arg
A 1,=F‟1‟
ST 1,&arg
MEND
Macro
ADDS &arg1,&arg2,&arg3
ADD1 &arg1
ADD1 &arg2
ADD1 &arg3
MEND
25
Mrs.
Saranya
V,AP/BCA,TICM
MACRO CALLS WITHIN THE MACROS(CONTD..)
Source code Expanded code(Level 1) Expanded code(Level 2)
MACRO
ADD 1, &arg
L 1, &arg
A 1, = F ‘10’
ST 1, &arg
MEND
MACRO
ADDS &arg1,
&arg2, arg3
ADD1 &arg1
ADD1 &arg2
ADD1 &arg3
MEND
:
:
ADDS data1,
data2, data3
:
:
data 1 DC F‘5’
data 2 DC F‘6’
data 3 DC F‘7’
END
Expansion of ADDS
:
:
ADD1 data 1
ADD1 data 2
ADD1 data 3
Expansion of ADD1
L 1, data 1
A 1, = F „10‟
ST 1, data 1
L 1, data 2
A 1, = F „10‟
ST 1, data 2
L 1, data 3
A 1, = F „10‟
ST 1, data 3
data1 DC F‘5’
data2 DC F‘6’
data3 DC F‘7’
END
26
Mrs.
Saranya
V,AP/BCA,TICM
MACRO DEFINITIONS WITHIN MACRO
DEFINITION
 This feature helps to defining a group of similar macro‟s using
a single macro instruction
 It is possible to have macro definition with in the body of
macro. The inner macro definition is not defined until the outer
macro has been called.
MACRO
DEFINE &SUB
MACRO
&SUB &Y
CNOP 0,4
BAL 1,*+8
DC A(&Y)
L 15,=V(&SUB)
BALR 14,15
MEND
MEND
Definition
of macro
&SUB
Definition of
macro DEFINE
27
Mrs.
Saranya
V,AP/BCA,TICM
IMPLEMENTATION OF A MACRO PROCESSOR
 The macro process taken as input an ALP which
contains macro definition and macro calls.
 Then it transforms to expanded source without
consisting macro definition and macro calls is through
the translator it will be convert as an object code.
28
Mrs.
Saranya
V,AP/BCA,TICM
IMPLEMENTATION(CONTD..)
 There are four basic task that a macro-processor must
perform
1. Recognize macro definition
 A macro instruction processor must recognize macro
definition identified by MACRO & MEND pseudo –
operations.
2. Save the Definition
 The processor must store the macro – definitions which
will be needed at the time of expansion of calls.
29
Mrs.
Saranya
V,AP/BCA,TICM
IMPLEMENTATION(CONTD..)
3. Recognize the Macro call
 The processor must recognize macro calls that appear
as operation mnemonics.
4. Expand calls & substitute arguments
 The macro call is replaced by the macro definition.
 The dummy arguments are replaced by the actual data
.
30
Mrs.
Saranya
V,AP/BCA,TICM
IMPLEMENTATION OF A RESTRICTED FACILITY:
A TWO PASS ALGORITHM
 The following assumptions are made.
 Macro processor is the functionality independent of
the assembler.
 Output from the macro processor will be fed into the
assembler.
 Macro calls or definitions within macro definition are
not allowed because of its complications.
31
Mrs.
Saranya
V,AP/BCA,TICM
TWO PASS ALGORITHM(CONTD..)
Macro processor performs expansion using 2 passes
 Pass I- Processing macro definitions
 It examines every operation code
 Save all macro definitions in a macro definition table
and macro name table
 Save a copy of the input text , minus macro definition
 Pass II- Processing macro calls and expansion
 Identify macro calls
 Replace each macro name with the appropriate text
from macro definition(expand macro call)
32
Mrs.
Saranya
V,AP/BCA,TICM
TWO PASS ALGORITHM- SPECIFICATION
OF DATA BASE
 PASS I- Databases
 The input macro source deck
 Output macro source deck copy for use by pass2
 Macro Definition Table(MDT)
 Macro Name Table(MNT)
 Macro Definition Table Counter(MDNTC)
 Macro Name Table Counter(MNTC)
 Argument List Array(ALA)
33
Mrs.
Saranya
V,AP/BCA,TICM
TWO PASS ALGORITHM- SPECIFICATION
OF DATA BASE(CONTD..)
 Pass 2- Databases
 The copy input macro source deck
 Output expanded source deck copy for use by assembler
 Macro Definition Table(MDT) created by pass1
 Macro Name Table(MNT) created by pass1
 Macro Definition Table Pointer(MDNTP)
 Argument List Array(ALA)
34
Mrs.
Saranya
V,AP/BCA,TICM
SPECIFICATION OF DATA BASE FORMAT
Arguments List array:
It maintains the details about the parameters. It is used in
both pass1 and pass2, but the functions are reverse in both
the passes.
ALA in pass1
 In this when the macro definition are stored the arguments
in definition are replaced by index markers.
 # is the index marker, which is preceded by the dummy
argument.
35
Mrs.
Saranya
V,AP/BCA,TICM
SPECIFICATION OF DATA BASE
FORMAT(CONTD..)
 ALA in pass2
 In this argument in the macro call are substituted
for the index marker stored in macro definition
 In the above example the macro call is
Loop Add data1, data2, data3
36
Mrs.
Saranya
V,AP/BCA,TICM
MACRO DEFINITION TABLE
 It is used to store the body of macro definition
 The size of MDT is 80-bytes per entry
 It will be read every line in the definition except
MACRO
37
Mrs.
Saranya
V,AP/BCA,TICM
MACRO NAME TABLE
 It is used to store the names of the defined macros
 Total size of MNT is 12-bytes per entry
 Each MNT entry consists of
 A character string (the macro name) (8 bytes)&
 A pointer (index)(4 bytes) to the entry in MDT that
corresponds to the beginning of the macro
definition.(MDT index) 38
Mrs.
Saranya
V,AP/BCA,TICM
TWO PASS MACRO PROCESSOR ALGORITHM
PASS 1: MACRO DEFINITION
Pass1 is used to store and processing macro definitions
 1. Initialize or set MDTC as well as MNTC=1
 2. Read the first line from the source code
 3. A) If it is a macro pseudo op
 The entire macro definition except macro is stored in MDT
 Read next line from source
 Enter macro name and MDTC value stored in MNT
 Then increment MNTC value
 Prepare ALA
 Enter the macro name line in MDT then increment MDTC value
 Read next line from source i.e., sequence then activate ALA in pass1
 Substitute index marker for the dummy argument
 Enter these values in MDT then increment MDTC value
 Repeat these procedure until we get MEND pseudo op code
 3. B) If it is not a macro pseudo op code then copy the source code into
pass2
 4. If it is a MEND pseudo op code read the next line from source code
otherwise the same
 procedure will be continue
39
Mrs.
Saranya
V,AP/BCA,TICM
MACRO
Add
A 1, data
A 2, data
A 3, data
MEND
40
Mrs.
Saranya
V,AP/BCA,TICM
TWO PASS MACRO PROCESSOR ALGORITHM
PASS 2: MACRO CALLS & EXPANSION
Pass2 is used for specifying macro calls and expansion
 1. Read next line from the source code copied by pass1
 2. Search macro name table for match with that code
 a) Check whether you have encountered macro name then the
MDT index of that macro name entered into MDTP
 Then activate argument list array
 Increment MDTP value by one
 Read next line from MDT and substitute arguments for macro call
 Substitute arguments from macro calls
 Check whether you have encountered MEND pseudo-op
i)If it is a MEND pseudo op then, read the next statement from the source
otherwise write the expanded source code
ii) If it is not a macro name directly write into expanded source code
 b)If you have not encountered a macro call,write into expanded
source card file.
 c) Check whether you have encountered END pseudo-op
i)If End,transfer expanded source file to the assembler for further processing.
ii) If not END, Goto step1.
41
Mrs.
Saranya
V,AP/BCA,TICM
42
Mrs.
Saranya
V,AP/BCA,TICM
A SINGLE PASS ALGORITHMS FOR MACRO
DEFINITIONS WITHIN MACROS
 There are 2 additional variables are used in simple one pass
macro processor. They are:
 MDI [Macro Definition Indicator]
 It is used to keep track of macro calls
 It has 2 states ON and OFF
 While expanding a macro calls, then MDI=ON otherwise
MDI=OFF
 MDLC [Macro Definition Level Counter]
 It is used to keep track of macro definition
 It is a counter for MACRO and MEND pseudo op
 When macro pseudo op is encountered then MDLC is
incremented by 1 and It is decremented by 1 when MEND
pseudo op is encountered 43
Mrs.
Saranya
V,AP/BCA,TICM
A SINGLE PASS
ALGORITHMS FOR
MACRO DEFINITIONS
WITHIN MACROS
44
Mrs.
Saranya
V,AP/BCA,TICM
45
Mrs.
Saranya
V,AP/BCA,TICM
IMPLEMENTATION OF MACRO CALLS WITHIN
MACROS
 If a macro call is encountered during the
expansion of a macro, the macro
processor will have to expand the included
macro call and then finish expanding the
closed macro. This implementation
involves recursion.
 Hence something is done store the status
of macro while they are expanded as the
outer macro needs to be expanded form a
position from where it was left while calling
the inner macro.
 We make use of stack to store the state of
macro when a macro call is made with in
another macro.
MACRO
ADD 1, &arg
L 1, &arg
A 1, = F ‘10’
ST 1, &arg
MEND
MACRO
ADDS &arg1, &arg2,
arg3
ADD1 &arg1
ADD1 &arg2
ADD1 &arg3
MEND
46
Mrs.
Saranya
V,AP/BCA,TICM
ORGANIZATIO
N OF STACK
FRAME
47
Mrs.
Saranya
V,AP/BCA,TICM
ONE PASS MACRO
PROCESSOR CAPABLE
OF HANDLING MACRO
CALLS WITHIN MACRO
DEFINITIONS
48
Mrs.
Saranya
V,AP/BCA,TICM
READ FUNCTION
FOR MACRO
EXPANSION
49
Mrs.
Saranya
V,AP/BCA,TICM
ONE PASS MACRO PROCESSOR
50
Mrs.
Saranya
V,AP/BCA,TICM
CHRONOLOGY OF PROCESSING EXAMPLE
51
Mrs.
Saranya
V,AP/BCA,TICM
MACRO PROCESSOR COMBINED
WITH ASSEMBLER PASS 1
There are two ways of implementing macro-
processor with assembler
 It can be added as pre-processor to an assembler,
making a complete pass over the input text before
pass1 of the assembler
Or
 It can be implemented within pass1 of the
assembler
52
Mrs.
Saranya
V,AP/BCA,TICM
MACRO PROCESSOR COMBINED WITH
ASSEMBLER PASS 1- PROS & CONS
 Advantages:
1. Many function need not be implanted twice i.e. read a
card, test a statement etc.
2. There is less overhead, since there are no intermediate
files needed over here.
3. More flexible since the user can make use of more
features.
 Disadvantages:
1. The integration may be too complex and lengthy.
2. Problem with integration as two groups of persons for
pass 1 of assembler and macro processor.
53
Mrs.
Saranya
V,AP/BCA,TICM
MACRO PROCESSOR COMBINED WITH
ASSEMBLER PASS 1
54
Mrs.
Saranya
V,AP/BCA,TICM
MACRO PROCESSOR COMBINED WITH
ASSEMBLER PASS 1- ALGORITHM
1. READ (similar to read of macro processor with stack)
2. Search POT
3. If pseudo code found
a. Then find type
i. MACRO
1. Then use macro defintion with stack.
2. GOTO step 1.
ii. Other
1. Then similar task as that of pass 1
assembler.
2. GOTO step 1.
iii. END GOTO pass 2 of assembler.
4. Else search the MNT if found
a. Set up macro call process
b. GOTO step 1.
5. Else search MOT
6. Process machine instructions.
7. GOTO step 2.
55
Mrs.
Saranya
V,AP/BCA,TICM
56
Mrs.
Saranya
V,AP/BCA,TICM

More Related Content

PDF
Macro-processor
PPTX
MACRO PROCESSOR
PPT
Assemblers: Ch03
PPTX
Assemblers
PPTX
Unit 4 sp macro
PPTX
Single pass assembler
PPTX
System Programming- Unit I
PPTX
Introduction to loaders
Macro-processor
MACRO PROCESSOR
Assemblers: Ch03
Assemblers
Unit 4 sp macro
Single pass assembler
System Programming- Unit I
Introduction to loaders

What's hot (20)

PDF
loaders and linkers
PPTX
Unit 3 sp assembler
PPTX
System Programming Unit II
PPTX
Linker and Loader
PPTX
Two pass Assembler
PPTX
System software - macro expansion,nested macro calls
PPTX
System Programing Unit 1
PPTX
Language processing activity
PPTX
Loaders ( system programming )
PPT
Java layoutmanager
PPT
Introduction to Compiler design
PPTX
Ch 4 linker loader
PPTX
Fundamentals of Language Processing
PPTX
Compilers
PPT
Pass 1 flowchart
PPT
EVOLUTION OF SYSTEM
PPTX
Lexical analyzer generator lex
PPTX
Direct linking loaders
PPTX
Ch 3 Assembler in System programming
PPTX
Structure of the compiler
loaders and linkers
Unit 3 sp assembler
System Programming Unit II
Linker and Loader
Two pass Assembler
System software - macro expansion,nested macro calls
System Programing Unit 1
Language processing activity
Loaders ( system programming )
Java layoutmanager
Introduction to Compiler design
Ch 4 linker loader
Fundamentals of Language Processing
Compilers
Pass 1 flowchart
EVOLUTION OF SYSTEM
Lexical analyzer generator lex
Direct linking loaders
Ch 3 Assembler in System programming
Structure of the compiler
Ad

Similar to Macro Processor (20)

PPTX
Unit ii-111206004636-phpapp01
PPTX
SPOS UNIT 2 MACRO NOTES SPOS UNIT 2 MACRO NOTESSPOS UNIT 2 MACRO NOTESSPOS...
PDF
Unit 2
PPT
PDF
handout6.pdf
PDF
Handout#05
PDF
33443223 system-software-unit-iv
PPTX
Presentation on macros and macro processor
PPT
Macros in system programing
PPT
Cp0675 03 may-2012-rm04
PDF
Handout#04
PPTX
Macro assembler
PDF
Module 5.pdf
PPTX
macro Macro Processors
PPTX
System Programming Unit II
PPT
ELENA MICROPROCESSOR
PPTX
Chap6 procedures &amp; macros
DOC
Chapter 5 notes new
PPT
SAS Macros part 1
Unit ii-111206004636-phpapp01
SPOS UNIT 2 MACRO NOTES SPOS UNIT 2 MACRO NOTESSPOS UNIT 2 MACRO NOTESSPOS...
Unit 2
handout6.pdf
Handout#05
33443223 system-software-unit-iv
Presentation on macros and macro processor
Macros in system programing
Cp0675 03 may-2012-rm04
Handout#04
Macro assembler
Module 5.pdf
macro Macro Processors
System Programming Unit II
ELENA MICROPROCESSOR
Chap6 procedures &amp; macros
Chapter 5 notes new
SAS Macros part 1
Ad

Recently uploaded (20)

PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
DOCX
573137875-Attendance-Management-System-original
PPT
Project quality management in manufacturing
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
573137875-Attendance-Management-System-original
Project quality management in manufacturing
UNIT 4 Total Quality Management .pptx
Sustainable Sites - Green Building Construction
Internet of Things (IOT) - A guide to understanding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
Lecture Notes Electrical Wiring System Components
Foundation to blockchain - A guide to Blockchain Tech
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Model Code of Practice - Construction Work - 21102022 .pdf
R24 SURVEYING LAB MANUAL for civil enggi
Automation-in-Manufacturing-Chapter-Introduction.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
bas. eng. economics group 4 presentation 1.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
CH1 Production IntroductoryConcepts.pptx

Macro Processor

  • 1. MACRO LANGUAGE & MACRO PROCESSOR Prepared by Mrs. Saranya V, M.Sc., M.Phil. Assistant Professor, BCA Dept., TICM
  • 2. CONTENT  MACRO LANGUAGE AND THE MACRO PROCESSOR: Macroinstruction, Features of macro Facility, Macro instruction arguments, conditional macro Expansion, macro calls within macros, macro Instructions defining macros, Implementation, Statement of problem, implementation of a restricted facility, A two pass algorithm. A single pass algorithm, implementation of macro calls within macros. Implementation within an assembles. 2 Mrs. Saranya V,AP/BCA,TICM
  • 3. MACRO INSTRUCTIONS  Sometimes need to repeat some blocks of code several times in our program/task. In such cases to avoid this repetition the system software provides us with special component i.e., MACRO  Macro instructions is a notational convenience for the programmer that it allows the programmer to write a short hand version of a program Source code (with macro) Macro processor Expanded code Object code Compiler or Assembler 3 Mrs. Saranya V,AP/BCA,TICM
  • 4. MACRO  Macro instructions are single line abbreviations for group of instructions.  Using a macro, programmer can define a single “instruction” to represent blockof code.  The design of macro processor is generally machine independent.  Every programming language will be using the macro processor 4 Mrs. Saranya V,AP/BCA,TICM
  • 5. MACRO PROS & CONS Advantage:  The frequent use of macros can reduce programmer- induced errors.  A macro allows to define instruction sequences that are used repetitively throughout the program.  The scope of the symbol is limited to that macro only. Disadvantage:  The size of the program is little higher. The reason is, the pre-processor will replace all the macros in the program by its real definition prior to the compilation process of the program. 5 Mrs. Saranya V,AP/BCA,TICM
  • 6. MACRO VS SUB-ROUTINE  Used when maximum processor speed is required.  Used when amount of memory consumed is less important.  Each invocation includes the assembly code associated with the macro in-line  Speeds up the execution of algorithm  Should be used when certain procedures are frequently executed.  Used when use of memory must be kept minimum.  Each invocation requires only the code necessary to call subroutine  Program size can be reduced Macro Sub-routine 6 Mrs. Saranya V,AP/BCA,TICM
  • 7. MACRO-PROCESSOR FUNCTIONS There are 3 main functions of macro processor. They are  1. Macro definition  2. Macro calls or invocation  3. Macro expansion 7 Mrs. Saranya V,AP/BCA,TICM
  • 8. MACRO DEFINITION  Macro definition attaches a name to a sequence of instruction/operations  Structure of macro-definition MACRO starting of macro definition [ ] macro_name ……………. ……………. sequence of instruction ……………. MEND ending of macro definition 8 Mrs. Saranya V,AP/BCA,TICM
  • 9. MACRO DEFINITION(CONTD..)  The macro definition starts with MACRO pseudo op code.  It indicates beginning of the macro definition.  The Macro-definition terminated with the MEND pseudo op code. A 1, data A 2, data A 3, data ….. ….. A 1, data A 2, data A 3, data ….. ….. A 1, data A 2, data A 3, data ….. ….. Data DC f „5‟ 9 Mrs. Saranya V,AP/BCA,TICM
  • 10. MACRO DEFINITION(CONTD..)  In the above example the sequence of A 1, data A 2, data A 3, data  It repeats 3 times MACRO permits as to attach a name to this sequence and to use the name in its place then the macro definition will be MACRO Add A 1, data A 2, data A 3, data MEND  MACRO=> is a pseudo op indicates beginning of definition  Add => is the name of the macro  MEND => is a pseudo op indicate end of the macro definition  Between the name of the Macro Add and MEND we have the sequence of instruction. 10 Mrs. Saranya V,AP/BCA,TICM
  • 11. MACRO CALLS OR INVOCATION  Once the macro has been defined, the use of the macro name as an operation mnemonic in an ALP is equivalent to corresponding instruction sequence  Sequence of instruction are simply substituted at the point of call or macro name is referred as macro call  In the above mentioned example sequence will be repeated thrice, then we need to replace sequence by macro name like: MACRO Add A 1, data A 2, data A 3, data MEND So, the main program looks like ……. Add …… Add …… Data DC f „5‟ 11 Mrs. Saranya V,AP/BCA,TICM
  • 12. MACRO EXPANSIONS  Whenever the program needs the instruction in the place of macro name then we need macro expansion.  The macro-processor replace each macro calls with the defined set of instructions. This process of replacement is called macro expansion. MACRO Add A 1, data A 2, data A 3, data MEND ……. Add …… Add …… Data DC f „5‟ A 1, data A 2, data A 3, data A 1, data A 2, data A 3, data Does not appear Expanded Program Source Program 12 Mrs. Saranya V,AP/BCA,TICM
  • 13. Input File Macro names Macro definitions Scan file for macros Extract macros with name and definition Scan for macro names Replace macro name with Corresponding definition Processed File Block Representation of Macro Expansion 13 Mrs. Saranya V,AP/BCA,TICM
  • 14. FEATURES OF MACRO FACILITY:  There are mainly 4 important feature of macro. They are 1. Macro instruction argument 2. Conditional macro expansion 3. Macro calls within macros 4. Macro instruction defining macros 14 Mrs. Saranya V,AP/BCA,TICM
  • 15. MACRO INSTRUCTION ARGUMENT  To overcome lack of flexibility problem, we use macro instructions arguments where these arguments are appears in macro call.  The corresponding macro dummy arguments are appears in macro definition.  Eg: A 1,data1 A 2,data2 A 3,data3 : A 1,data3 A 2,data2 A 3,data1 : data1 DC F‟5‟ data2 DC F‟6‟ 15 Mrs. Saranya V,AP/BCA,TICM
  • 16. Source MACRO INCR &arg (Macro name with A 1,&arg one argument) A 2,&arg A 3,&arg MEND : : INCR data1 (use of data1 as : operand) : INCR data 2 (use of data1 as : operand) data1 DC F’5’ data2 DC F’6’ : END F’6’ Expanded Source : : : : : A 1,data1 A 2,data1 A 3,data1 : A 1,data2 A 2,data2 A 3,data2 : : data1 DC F’5’ data2 DC MACRO INSTRUCTION ARGUMENT(CONTD..) 16 Mrs. Saranya V,AP/BCA,TICM
  • 17. MORE THAN ONE ARGUMENT IN MACRO CALL Source MACRO INCR & arg 1, & arg 2, & arg 3,& lab 1 & lab1 A 1, &arg1 A 2, &arg2 A 3, &arg3 MEND : : : LOOP1 INCR data1, data2, data3 : : : LOOP2 INCR data3, data2, data1 : : data1 DC F ‘5’ data2 DC F ‘6’ data3 DC F ‘7’ Expanded source : : : : : : : : LOOP 1 A 1, data 1 A 2, data 2 A 3, data 3 : : LOOP 2 A 1, data3 A 2, data2 A 3, data1 : data1 DC F ‘5’ data2 DC F ‘6’ data3 DC F ‘7’ 17 Mrs. Saranya V,AP/BCA,TICM
  • 18. TWO WAYS OF SPECIFYING ARGUMENTS TO A MACRO CALL  Positional argument  Argument are matched with dummy arguments according to order in which they appear. Eg:INCR A,B,C “A‟ replaces first dummy argument “B‟ replaces second dummy argument “C‟ replaces third dummy argument 18 Mrs. Saranya V,AP/BCA,TICM
  • 19. TWO WAYS OF SPECIFYING ARGUMENTS TO A MACRO CALL(CONTD..)  Keyword Argument  This allows reference to dummy arguments by name as well as by position. e.g. INCR &arg1 = A,&arg3 = C, &arg2 =‟B‟ (Or) INCR &arg1= A, &arg2 = B, &arg2 =‟C‟ 19 Mrs. Saranya V,AP/BCA,TICM
  • 20. CONDITIONAL MACRO EXPANSION  This allows conditional selection of machine instructions that appear in expansion of macro call.  The sequence of macro expansion can be reordered or change based on some conditions.  There are 2 Important macro processor pseudo op. they are AIF AGO 20 Mrs. Saranya V,AP/BCA,TICM
  • 21. AIF  It is a conditional branching pseudo op the format of AIF is AIF<expression>.<sequencing label>  Where expression is a relational expression, it involves strings, numbers etc.  If the expression evaluates to true them the control transferred to the statements containing the sequencing label  Otherwise, the control transferred to the next statement followed by AIF  AIF statement does not appears in the expanded source code 21 Mrs. Saranya V,AP/BCA,TICM
  • 22. AGO  It is an unconditional branching pseudo op the format of AGO is AGO.<Sequencing label>  It is conditional transfer control to the statement containing sequencing label  Each and every label must be starting with a .(dot) operator.  AGO statement does not appear in the expanded source code. Ex: Loop1 A 1,data1 A 2, data2 A 3, data3 Loop2 A 1,data3 A 2, data2 Loop3 A 1, data1 22 Mrs. Saranya V,AP/BCA,TICM
  • 23. FINI  FINI is a macro label.  Labels starting with a period(.) such as .FINI, are macro labels and don't appear in the output of the macro processor. AIF (& COUNT EQ 1).FINI  It directs the macro processor to skip to statement labeled FINI if the parameter corresponding to & COUNT is 1,otherwise the macroprocessor continues with the statement following the AIF pseudo-op 23 Mrs. Saranya V,AP/BCA,TICM
  • 24. CONDITIONAL MACRO EXPANSION(CONTD..) Source Program MACRO & arg0 INCR & count, & arg1, & arg 2, & arg3 & arg0 A 1, &arg1 AIF (& Count EQ.1). FINAL A 2,& arg2 AIF (&count EQ 2). FINAL A 3, &arg3 .FINAL MEND : LOOP1 INCR 3, data1, data2, data3 : : LOOP2 INCR 2, data3, data2 : LOOP3 INCR 1, data1 : data1 DC ‘5’ data2 DC ‘6’ data3 DC ‘7’ Expanded Program LOOP1 A 1, data1 A 2, data2 A 3, data3 LOOP2 A 1, data3 A 2, data2 : LOOP3 A 1, data1 : data1 DC ‘5’ data2 DC ‘6’ data3 DC ‘7’ : 24 Mrs. Saranya V,AP/BCA,TICM
  • 25. MACRO CALLS WITHIN THE MACROS  Macro calls can be called only after being defined. Sometimes one macro will call another macro such a concept is called macro calls  “Macro can be called within the definition of the another macro this is also referred as nested macros”  The definition of called macro should appear before the macro definition which contains the macro call. Macro ADD1 &argL 1,&arg A 1,=F‟1‟ ST 1,&arg MEND Macro ADDS &arg1,&arg2,&arg3 ADD1 &arg1 ADD1 &arg2 ADD1 &arg3 MEND 25 Mrs. Saranya V,AP/BCA,TICM
  • 26. MACRO CALLS WITHIN THE MACROS(CONTD..) Source code Expanded code(Level 1) Expanded code(Level 2) MACRO ADD 1, &arg L 1, &arg A 1, = F ‘10’ ST 1, &arg MEND MACRO ADDS &arg1, &arg2, arg3 ADD1 &arg1 ADD1 &arg2 ADD1 &arg3 MEND : : ADDS data1, data2, data3 : : data 1 DC F‘5’ data 2 DC F‘6’ data 3 DC F‘7’ END Expansion of ADDS : : ADD1 data 1 ADD1 data 2 ADD1 data 3 Expansion of ADD1 L 1, data 1 A 1, = F „10‟ ST 1, data 1 L 1, data 2 A 1, = F „10‟ ST 1, data 2 L 1, data 3 A 1, = F „10‟ ST 1, data 3 data1 DC F‘5’ data2 DC F‘6’ data3 DC F‘7’ END 26 Mrs. Saranya V,AP/BCA,TICM
  • 27. MACRO DEFINITIONS WITHIN MACRO DEFINITION  This feature helps to defining a group of similar macro‟s using a single macro instruction  It is possible to have macro definition with in the body of macro. The inner macro definition is not defined until the outer macro has been called. MACRO DEFINE &SUB MACRO &SUB &Y CNOP 0,4 BAL 1,*+8 DC A(&Y) L 15,=V(&SUB) BALR 14,15 MEND MEND Definition of macro &SUB Definition of macro DEFINE 27 Mrs. Saranya V,AP/BCA,TICM
  • 28. IMPLEMENTATION OF A MACRO PROCESSOR  The macro process taken as input an ALP which contains macro definition and macro calls.  Then it transforms to expanded source without consisting macro definition and macro calls is through the translator it will be convert as an object code. 28 Mrs. Saranya V,AP/BCA,TICM
  • 29. IMPLEMENTATION(CONTD..)  There are four basic task that a macro-processor must perform 1. Recognize macro definition  A macro instruction processor must recognize macro definition identified by MACRO & MEND pseudo – operations. 2. Save the Definition  The processor must store the macro – definitions which will be needed at the time of expansion of calls. 29 Mrs. Saranya V,AP/BCA,TICM
  • 30. IMPLEMENTATION(CONTD..) 3. Recognize the Macro call  The processor must recognize macro calls that appear as operation mnemonics. 4. Expand calls & substitute arguments  The macro call is replaced by the macro definition.  The dummy arguments are replaced by the actual data . 30 Mrs. Saranya V,AP/BCA,TICM
  • 31. IMPLEMENTATION OF A RESTRICTED FACILITY: A TWO PASS ALGORITHM  The following assumptions are made.  Macro processor is the functionality independent of the assembler.  Output from the macro processor will be fed into the assembler.  Macro calls or definitions within macro definition are not allowed because of its complications. 31 Mrs. Saranya V,AP/BCA,TICM
  • 32. TWO PASS ALGORITHM(CONTD..) Macro processor performs expansion using 2 passes  Pass I- Processing macro definitions  It examines every operation code  Save all macro definitions in a macro definition table and macro name table  Save a copy of the input text , minus macro definition  Pass II- Processing macro calls and expansion  Identify macro calls  Replace each macro name with the appropriate text from macro definition(expand macro call) 32 Mrs. Saranya V,AP/BCA,TICM
  • 33. TWO PASS ALGORITHM- SPECIFICATION OF DATA BASE  PASS I- Databases  The input macro source deck  Output macro source deck copy for use by pass2  Macro Definition Table(MDT)  Macro Name Table(MNT)  Macro Definition Table Counter(MDNTC)  Macro Name Table Counter(MNTC)  Argument List Array(ALA) 33 Mrs. Saranya V,AP/BCA,TICM
  • 34. TWO PASS ALGORITHM- SPECIFICATION OF DATA BASE(CONTD..)  Pass 2- Databases  The copy input macro source deck  Output expanded source deck copy for use by assembler  Macro Definition Table(MDT) created by pass1  Macro Name Table(MNT) created by pass1  Macro Definition Table Pointer(MDNTP)  Argument List Array(ALA) 34 Mrs. Saranya V,AP/BCA,TICM
  • 35. SPECIFICATION OF DATA BASE FORMAT Arguments List array: It maintains the details about the parameters. It is used in both pass1 and pass2, but the functions are reverse in both the passes. ALA in pass1  In this when the macro definition are stored the arguments in definition are replaced by index markers.  # is the index marker, which is preceded by the dummy argument. 35 Mrs. Saranya V,AP/BCA,TICM
  • 36. SPECIFICATION OF DATA BASE FORMAT(CONTD..)  ALA in pass2  In this argument in the macro call are substituted for the index marker stored in macro definition  In the above example the macro call is Loop Add data1, data2, data3 36 Mrs. Saranya V,AP/BCA,TICM
  • 37. MACRO DEFINITION TABLE  It is used to store the body of macro definition  The size of MDT is 80-bytes per entry  It will be read every line in the definition except MACRO 37 Mrs. Saranya V,AP/BCA,TICM
  • 38. MACRO NAME TABLE  It is used to store the names of the defined macros  Total size of MNT is 12-bytes per entry  Each MNT entry consists of  A character string (the macro name) (8 bytes)&  A pointer (index)(4 bytes) to the entry in MDT that corresponds to the beginning of the macro definition.(MDT index) 38 Mrs. Saranya V,AP/BCA,TICM
  • 39. TWO PASS MACRO PROCESSOR ALGORITHM PASS 1: MACRO DEFINITION Pass1 is used to store and processing macro definitions  1. Initialize or set MDTC as well as MNTC=1  2. Read the first line from the source code  3. A) If it is a macro pseudo op  The entire macro definition except macro is stored in MDT  Read next line from source  Enter macro name and MDTC value stored in MNT  Then increment MNTC value  Prepare ALA  Enter the macro name line in MDT then increment MDTC value  Read next line from source i.e., sequence then activate ALA in pass1  Substitute index marker for the dummy argument  Enter these values in MDT then increment MDTC value  Repeat these procedure until we get MEND pseudo op code  3. B) If it is not a macro pseudo op code then copy the source code into pass2  4. If it is a MEND pseudo op code read the next line from source code otherwise the same  procedure will be continue 39 Mrs. Saranya V,AP/BCA,TICM
  • 40. MACRO Add A 1, data A 2, data A 3, data MEND 40 Mrs. Saranya V,AP/BCA,TICM
  • 41. TWO PASS MACRO PROCESSOR ALGORITHM PASS 2: MACRO CALLS & EXPANSION Pass2 is used for specifying macro calls and expansion  1. Read next line from the source code copied by pass1  2. Search macro name table for match with that code  a) Check whether you have encountered macro name then the MDT index of that macro name entered into MDTP  Then activate argument list array  Increment MDTP value by one  Read next line from MDT and substitute arguments for macro call  Substitute arguments from macro calls  Check whether you have encountered MEND pseudo-op i)If it is a MEND pseudo op then, read the next statement from the source otherwise write the expanded source code ii) If it is not a macro name directly write into expanded source code  b)If you have not encountered a macro call,write into expanded source card file.  c) Check whether you have encountered END pseudo-op i)If End,transfer expanded source file to the assembler for further processing. ii) If not END, Goto step1. 41 Mrs. Saranya V,AP/BCA,TICM
  • 43. A SINGLE PASS ALGORITHMS FOR MACRO DEFINITIONS WITHIN MACROS  There are 2 additional variables are used in simple one pass macro processor. They are:  MDI [Macro Definition Indicator]  It is used to keep track of macro calls  It has 2 states ON and OFF  While expanding a macro calls, then MDI=ON otherwise MDI=OFF  MDLC [Macro Definition Level Counter]  It is used to keep track of macro definition  It is a counter for MACRO and MEND pseudo op  When macro pseudo op is encountered then MDLC is incremented by 1 and It is decremented by 1 when MEND pseudo op is encountered 43 Mrs. Saranya V,AP/BCA,TICM
  • 44. A SINGLE PASS ALGORITHMS FOR MACRO DEFINITIONS WITHIN MACROS 44 Mrs. Saranya V,AP/BCA,TICM
  • 46. IMPLEMENTATION OF MACRO CALLS WITHIN MACROS  If a macro call is encountered during the expansion of a macro, the macro processor will have to expand the included macro call and then finish expanding the closed macro. This implementation involves recursion.  Hence something is done store the status of macro while they are expanded as the outer macro needs to be expanded form a position from where it was left while calling the inner macro.  We make use of stack to store the state of macro when a macro call is made with in another macro. MACRO ADD 1, &arg L 1, &arg A 1, = F ‘10’ ST 1, &arg MEND MACRO ADDS &arg1, &arg2, arg3 ADD1 &arg1 ADD1 &arg2 ADD1 &arg3 MEND 46 Mrs. Saranya V,AP/BCA,TICM
  • 48. ONE PASS MACRO PROCESSOR CAPABLE OF HANDLING MACRO CALLS WITHIN MACRO DEFINITIONS 48 Mrs. Saranya V,AP/BCA,TICM
  • 50. ONE PASS MACRO PROCESSOR 50 Mrs. Saranya V,AP/BCA,TICM
  • 51. CHRONOLOGY OF PROCESSING EXAMPLE 51 Mrs. Saranya V,AP/BCA,TICM
  • 52. MACRO PROCESSOR COMBINED WITH ASSEMBLER PASS 1 There are two ways of implementing macro- processor with assembler  It can be added as pre-processor to an assembler, making a complete pass over the input text before pass1 of the assembler Or  It can be implemented within pass1 of the assembler 52 Mrs. Saranya V,AP/BCA,TICM
  • 53. MACRO PROCESSOR COMBINED WITH ASSEMBLER PASS 1- PROS & CONS  Advantages: 1. Many function need not be implanted twice i.e. read a card, test a statement etc. 2. There is less overhead, since there are no intermediate files needed over here. 3. More flexible since the user can make use of more features.  Disadvantages: 1. The integration may be too complex and lengthy. 2. Problem with integration as two groups of persons for pass 1 of assembler and macro processor. 53 Mrs. Saranya V,AP/BCA,TICM
  • 54. MACRO PROCESSOR COMBINED WITH ASSEMBLER PASS 1 54 Mrs. Saranya V,AP/BCA,TICM
  • 55. MACRO PROCESSOR COMBINED WITH ASSEMBLER PASS 1- ALGORITHM 1. READ (similar to read of macro processor with stack) 2. Search POT 3. If pseudo code found a. Then find type i. MACRO 1. Then use macro defintion with stack. 2. GOTO step 1. ii. Other 1. Then similar task as that of pass 1 assembler. 2. GOTO step 1. iii. END GOTO pass 2 of assembler. 4. Else search the MNT if found a. Set up macro call process b. GOTO step 1. 5. Else search MOT 6. Process machine instructions. 7. GOTO step 2. 55 Mrs. Saranya V,AP/BCA,TICM