A macro in computer science is a rule or pattern that specifies how a certain input sequence (often a sequence of characters) should be mapped to an output sequence (also often a sequence of characters) according to a defined procedure.
The term originatedcitation needed] with macro-assemblers, where the idea is to make available to the programmer a sequence of computing instructions as a single program statement, making the programming task less tedious and less error-prone. Many different macro-instructions have been made available for various purposes, eliminating some of the repetitiveness of the programming, as well as simplifying the writing and the reading and understanding of the program, much of its complexity being hidden (more at #Text substitution macros below).