Showing posts with label UNIT IV - MACRO PROCESSORS. Show all posts
Showing posts with label UNIT IV - MACRO PROCESSORS. Show all posts

Friday, August 29, 2014

UNIT IV - MACRO PROCESSORS

1. How the macro is processed using two passes? 
Pass 1: processing of definitions
Pass 2:actual-macro expansion.

2. Give the advantage of line by line processors.
 It avoids the extra pass over the source program during assembling.
 It may use some of the utility that can be used by language translators so that can be loaded once.

3. What is meant by line by line processor?
 This macro processor reads the source program statements, process the statements and then the output lines are passed to the language translators as they are generated, instead of being written in an expanded file.

4. Give the advantages of general-purpose macro processors.
 The programmer does not need to learn about a macro facility for each compiler.
 Overall saving in software development cost and maintenance cost.

5. What is meant by general-purpose macro processors? 
The macro processors that are not dependent on any particular programming language, but can be used with a variety of different languages are known as general purpose macro processors. Eg. The ELENA macro processor.

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.