Download Assemblers and Loaders
Transcript
156 Macros Ch. 4 4.11 Review Questions and Projects 1. The process of expanding a macro includes two main steps, binding the formal paremeters to their actual arguments, and substituting each parameter in the macro’s body by its bound argument. Write a procedure, in pseudo-code, to implement the two steps. Assume that nested macro definition is not allowed, but nested macro expansion is allowed. 2. The syntax of macro definition and expansion differs from assembler to assembler. Use several textbooks and assembler manuals to study different conventions of defining macros and naming parameters. Summarize the resuts in a table of the form: Syntax of macro def Syntax of Maximum # Maximum # param-names of macros of params per macro Assembler A Assembler B – – 3. Continue the table of question 2 with columns for: Types of SET symbols, Syntax of SET symbol name, Syntax of sequence symbol name. 4. A macro named LOD can be used to redefine the LOD instruction. An assembler supporting this feature simply searches the MDT backwards. What is another way of redefining assembler instructions? 5. Review the block structure feature found in higher-level languages. What is the main difference between this feature and the scope of parameters in a nested macro definition? 6. What stacks are involved in nested macro definition and expansion? When (in what passes) are these stacks used? Is it possible to use the memory occupied by these stacks for something else? 7. What is a pass 0 directive? Make a list of all pass 0 directives mentioned in this chapter . 8. Compare the two methods described in this chapter for MDT implementation, the one with the MNT and the one without it. 9. Apply the two methods described in this chapter for handling nested macro definition to the case: