Macro Processors 1 Macro Processor l l Recognize
- Slides: 16
Macro Processors 1
Macro Processor l l Recognize macro definitions Save the macro definition Recognize macro calls Expand macro calls Source Code (with macro) Macro Processor Expanded Code Compiler or Assembler obj 2
Macro Definition l l l copy code parameter substitution macro instruction defining macros 3
Copy code -- Example Source STRG MACRO STA DATA 1 STB DATA 2 STX DATA 3 MEND. STRG. . Expanded source. . . STA DATA 1 STB DATA 2 STX DATA 3. { { 4
Parameter Substitution -- Example Source STRG MACRO &a 1, &a 2, &a 3 STA &a 1 STB &a 2 STX &a 3 MEND. STRG DATA 1, DATA 2, DATA 3. STRG DATA 4, DATA 5, DATA 6. . Expanded souce. . . STA STB STX. { { DATA 1 DATA 2 DATA 3 DATA 4 DATA 5 DATA 6 5
Sample Code TEST CELTOFER C F NINE FIVE THIRYTWO START MACRO LDA MULT DIV ADD STA MEND 2000 h &CEL &FER &CEL NINE FIVE THIRTYTWO &FER CELTOFER RESW WORD END C 1 1 9 5 32 F 6
One-Pass Macro Processor l Prerequisite » every macro must be defined before it is called l Sub-procedures » macro definition: DEFINE » macro invocation: EXPAND NAMTAB MACRO DEFINE DEFTAB CALL EXPAND ARGTAB PROCESSLINE 7
Data Structures -- Global Variables l l l DEFTAB NAMTAB ARGTAB EXPANDING 8
10
11
Nested Macros Definition l Macro definition within macros » process inner macro definition, during the expansion of outer macro Outer macro definition Inner macro definition 12
Nested Macro Definition Example TEST MACROS CELTOFER MACROF CELTOFER START MACRO LDA MULT DIV ADD STA MEND MACRO LDAF MULTF DIVF ADDF STAF MEND 2000 h &CEL &FER &CEL NINE FIVE THIRTYTWO &FER Integer instructions set Floating point instructions set 13
Nested Macro Definition Example C F NINE FIVE THIRYTWO MACROS CELTOFER RESW WORD MACROF CELTOFER RESW WORD END C 1 1 9 5 32 F 14
One-Pass Macro Processor That Allows Nested Macro Definition l Sub-procedures » macro definition: DEFINE » macro invocation: EXPAND l EXPAND may invoke DEFINE when encounter macro definition NAMTAB DEFTAB ARGTAB Expanding MACRO DEFINE CALL EXPAND PROCESSLINE MACRO Definition 15
1 -Pass Macro Processor 16
- Explain single pass macro processor
- Macro processors
- Machine independent features of macro processor
- One pass macro processor
- What is a macro processor
- Econmovies episode 6 back to the future worksheet answers
- Embedded innovator winter 2010
- Parallel processors from client to cloud
- Difference between linear and nonlinear pipeline processors
- Beagleboard embedded processors
- Digital camera processors
- Introduction to telecommunication
- Programming massively parallel processors
- Interrupt handling in arm processors
- Network systems design using network processors
- Advantages and disadvantages of intel processors
- Comparison of word processors