Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Macro (computer science)
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Rule for substituting a set input with a set output}} {{Redirect|Macro language|ISO macrolanguages|ISO 639 macrolanguage}} [[File:Jedit macro recorder.png|thumb|250px|[[jEdit|jEdit's]] macro editor]] In [[computer programming]], a '''macro''' (short for "'''macro instruction'''"; {{ety|el|''μακρο''-|long, large}}<ref>''[[Oxford English Dictionary]]'', ''s.v.'' [https://www.oed.com/view/Entry/111926 macro], [https://www.oed.com/view/Entry/233194 macro-instruction], and [https://www.oed.com/view/Entry/111927 macro-]</ref>) is a rule or [[pattern]] that specifies how a certain input should be [[Map (mathematics)|mapped]] to a replacement output. Applying a macro to an input is known as '''macro expansion'''. The input and output may be a sequence of [[lexical token]]s or [[Character (computing)|characters]], or a [[abstract syntax tree|syntax tree]]. Character macros are supported in [[software application]]s to make it easy to invoke common [[Command (computing)|command]] sequences. Token and tree macros are supported in some [[programming language]]s to enable [[code reuse]] or to extend the language, sometimes for [[domain-specific languages]]. Macros are used to make a sequence of computing instructions available to the programmer as a single [[program statement]], making the programming task less tedious and less error-prone.<ref>{{cite journal |last1=Greenwald |first1=Irwin D. |last2=Kane |first2=Maureen |date=April 1959 |title=The Share 709 System: Programming and Modification |journal=Journal of the ACM |location=New York, NY, USA |publisher=ACM |volume=6 |issue=2 |pages=128–133 |doi=10.1145/320964.320967 |s2cid=27424222 |quote=One of the important uses of programmer macros is to save time and clerical-type errors in writing sequence of instructions which are often repeated in the course of a program. |doi-access=free}}</ref><ref>{{cite journal | last = Strachey| first = Christopher | title = A General Purpose Macrogenerator| journal = Computer Journal| volume = 8 | issue = 3 | pages = 225–241|date=October 1965 | doi = 10.1093/comjnl/8.3.225 |author-link=Christopher Strachey| doi-access = free}}</ref> Thus, they are called "macros" because a "big" [[Block (programming)|block of code]] can be expanded from a "small" sequence of characters. Macros often allow positional or keyword parameters that dictate what the [[Conditional assembly language|conditional assembler]] program generates and have been used to create entire [[Computer program|programs]] or program suites according to such variables as [[operating system]], [[Computing platform|platform]] or other factors. The term derives from "macro instruction", and such expansions were originally used in generating [[assembly language]] code.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)