Difficulty: Easy
Correct Answer: All of the above
Explanation:
Introduction / Context:
Macro processors extend an assembler or compiler by allowing parameterized code templates (macros). They reduce repetition, encode patterns, and improve maintainability. Understanding their essential duties clarifies how macro expansion integrates into the translation flow.
Given Data / Assumptions:
Concept / Approach:
A proper macro system must parse and record macro definitions, differentiate normal statements from macro calls, and perform argument substitution to yield expanded, concrete source lines that downstream phases can assemble/compile normally.
Step-by-Step Solution:
Verification / Alternative check:
Preprocessed output (listing) shows calls replaced by expanded code identical to hand-written code, demonstrating correct recognition, storage, and expansion.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing macro expansion with inline functions or templates at compile time; forgetting argument substitution rules, default parameters, or nesting behavior.
Final Answer:
All of the above.
Discussion & Comments