Thursday, August 28, 2014

UNIT IV - MACRO PROCESSORS

1. Define macro processor.
Macro processor is system software that replaces each macro instruction with the corresponding group of source language statements. This is also called as expanding of macros.


2. What do macro expansion statements mean?
 These statements give the name of the macroinstruction being invoked and the arguments to be used in expanding the macros. These statements are also known as macro call.

 3. What are the directives used in macro definition?
MACRO - it identifies the beginning of the macro definition
 MEND - it marks the end of the macro definition

4. What are the data structures used in macro processor? 
DEFTAB – the macro definitions are stored in a definition table i.e. it contains a macro prototype and the statements that make up the macro body. NAMTAB – it is used to store the macro names and it contains two pointers for each macro instruction which indicate the starting and end location of macro definition DEFTAB. it also serves as an index to DEFTAB ARGTAB – it is used to store the arguments during the expansion of macro invocations

5. Define conditional macro expansion.
If the macro is expanded depends upon some conditions in macro definition (depending on the arguments supplied in the macro expansion) then it is called as conditional macro expansion. 


6. What is the use of macro time variable? 
Macro time variable can be used to store working values during the macro expansion. Any symbol that begins with the character & and then is not a macro instruction parameter is assumed to be a macro time variable.

7. What are the statements used for conditional macro expansion?
IF-ELSE-ENDIF statement
 WHILE-ENDW statement 

8. What is meant by positional parameters? 
If the parameters and arguments were associated with each other according to their positions in the macro prototype and the macro invocation statement, then these parameters in macro definitions are called as positional parameters.

9. Consider the macro definition 
#define DISPLAY (EXPR) 
Printf (“EXPR = %d\n”, EXPR) 
Expand the macro instruction DISPLAY (ANS) 

Ans.: Printf (“EXPR = %d\n”, ANS)

10. What are known as nested macro call? 
The statement, in which a macro calls on another macro, is called nested macro all. In the nested macro call, the call is done by outer macro and the macro called is the inner macro.

No comments:

Post a Comment