Macro (computer science) in the context of Code reuse


Macro (computer science) in the context of Code reuse

Macro (computer science) Study page number 1 of 1

Play TriviaQuestions Online!

or

Skip to study material about Macro (computer science) in the context of "Code reuse"


⭐ Core Definition: Macro (computer science)

In computer programming, a macro (short for "macro instruction"; from Greek μακρο- 'long, large') is a rule or pattern that specifies how a certain input should be 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 tokens or characters, or a syntax tree. Character macros are supported in software applications to make it easy to invoke common command sequences. Token and tree macros are supported in some programming languages to enable code reuse or to extend the language, sometimes for domain-specific languages.

↓ Menu
HINT:

In this Dossier

Macro (computer science) in the context of Snippet (programming)

In computer programming, a snippet is a relatively small amount of source code that is stored and later inserted into a larger codebase as part of the process of writing the code. Some development tools such as a code editor or an integrated development environment (IDE) provide snippet management features to enhance productivity by allowing a developer to insert a fragment of code instead of typing it.

In contrast to an abstraction construct, such as a function, a snippet is a form of copy and paste programming – a macro operation that expands the stored template text and inserts the result into the source code. Snippet insertion is similar to a preprocessor macro except that it's like inserting the expansion of the macro definition rather than referencing it. Changing the snippet after insertion does not affect the code as does changing the definition of a preprocessor macro. For this reason, best practice is to use a snippet only for relatively simple code such as a function prototype, control structure, or library import. A snippet is typically used when an abstraction is not available (i.e. not supported by the programming language) or not desirable (i.e. due to runtime overhead).

View the full Wikipedia page for Snippet (programming)
↑ Return to Menu

Macro (computer science) in the context of TeX

TeX (/tɛx/), stylized within the system as TeX, is a typesetting program which was designed and written by computer scientist and Stanford University professor Donald Knuth and first released in 1978. The term now refers to the system of extensions – which includes software programs called TeX engines, sets of TeX macros, and packages which provide extra typesetting functionality – built around the original TeX language. TeX is a popular means of typesetting complex mathematical formulae; it has been noted as one of the most sophisticated digital typographical systems.

TeX is widely used in academia, especially in mathematics, computer science, economics, political science, engineering, linguistics, physics, statistics, and quantitative psychology. It has long since displaced Unix troff (the previously favored formatting system), in most Unix installations (although troff still remains as the default formatter of the UNIX documentation). It is also used for many other typesetting tasks, especially in the form of LaTeX, ConTeXt, and other macro packages.

View the full Wikipedia page for TeX
↑ Return to Menu

Macro (computer science) in the context of Emacs

Emacs (/ˈmæks/ ), originally named EMACS (an acronym for "Editor Macros"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant, GNU Emacs, describes it as "the extensible, customizable, self-documenting, real-time display editor". Development of the first Emacs began in the mid-1970s, and work on GNU Emacs, directly descended from the original, is ongoing; its latest version is 30.2 Edit this on Wikidata, released 14 August 2025.

Emacs has over 10,000 built-in commands and its user interface allows the user to combine these commands into macros to automate work. Implementations of Emacs typically feature a dialect of the Lisp programming language, allowing users and developers to write new commands and applications for the editor. Extensions have been written to, among other things, manage files, remote access, e-mail, outlines, multimedia, Git integration, RSS feeds, and collaborative editing, as well as implementations of ELIZA, Pong, Conway's Life, Snake, Dunnet, and Tetris.

View the full Wikipedia page for Emacs
↑ Return to Menu

Macro (computer science) in the context of Preprocessor macro

In computer science, a preprocessor (or precompiler) is a program that processes its input data to produce output that is used as input in another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent programs like compilers. The amount and kind of processing done depends on the nature of the preprocessor; some preprocessors are only capable of performing relatively simple textual substitutions and macro expansions, while others have the power of full-fledged programming languages.

A common example from computer programming is the processing performed on source code before the next step of compilation.In some computer languages (e.g., C and PL/I) there is a phase of translation known as preprocessing. It can also include macro processing, file inclusion and language extensions.

View the full Wikipedia page for Preprocessor macro
↑ Return to Menu