Topic: macros

topics > computer science > programming > Group: program representation


binding names to variables or expressions
case frame grammar
compile-time execution
conditional compilation
definition languages
function definition
generic operations and polymorphism
generated variable
in-line code
keyboard macros
language extension via macros
macro syntax definition
named constants and expressions
names as place holders
object-oriented templates and containers
parameter passing by name
pronoun reference
scripting language
semantic grammar
stepwise refinement
string transformation languages
structured editors
user-defined languages
words defined by words


Macros consist of a name, optional parameters, and a macro body. Each occurrence of the macro is replaced by the macro body. The body may include control instructions. Macros are equivalent to paraphrase extension, in-line procedures, and literals. Reduction languages define new functions as a paraphrase extension. Step-wise refinement can be done by unparameterized macros.

If provided, macros are used; mainly to define constants, allow later changes, remove duplicated expressions, and extend the host language. Heavy use of macros rapidly increases overhead and obscures a program's meaning. (cbb 5/80 and 1/93)

Subtopic: what is a macro? up

Quote: the body of a macro gains meaning only via its transcription to a specific language [»kostCH_1974]
Quote: use macrogeneration for semantic extension of a language [»straC8_1967]

Subtopic: macros for delayed binding -- might change up

Quote: define macros for anything that may change; allows delayed binding for implementation of the macros [»browPJ_1974]

Subtopic: examples up

QuoteRef: gammRC_1981 ;;A tiny portable language-independent macroprocessor and some applications
Quote: implement automated logins by introducing macro calls into command text; gives command set [»gammR_1982]
QuoteRef: wessBD_1965 ;;in Trac, DS,x,y defines x as y
QuoteRef: waitWM7_1967 ;;435 base language for the LIMP macro processor is close to Snobol
Quote: use macros to code each operation of the abstract machine [»poolPC10_1969]

Subtopic: problems with macros up

Quote: programming languages deal with abstract objects, contrary to the conventional view that programs are symbol strings plus rules for manipulating these strings; the later yields a macrogenerator without regard to semantics [»straC8_1967]
Quote: a good programming language should not need a macrogenerator
Quote: macros have not implemented higher-level languages because of poor mechanisms for notation and language processing [»halpMI1_1968]

Subtopic: include up

Quote: the C preprocessor expands an include statement into the named file's contents [»ritcDM7_1978c]
QuoteRef: cbb_1973 ;;11/27/73 INCLUDE is an elementary text macro

Subtopic: defined constants up

Quote: by defining constants via a macro processor, C allows any string of characters to be substituted [»ritcDM7_1978c]
QuoteRef: hehnEC7_1975 ;;15 allows literals such as j: 2*i+1

Subtopic: context-sensitive macros up

Quote: AUTOCODER's macro processors generated code that was data-sensitive and context-sensitive [»halpMI1_1968]
Quote: compile time macros that provide a full programming language, e.g., variables, labels, conditionals, repetition [»sammJE_1969, OK]
QuoteRef: granCA12_1971 ;;46 Grant's context macros example --escape macro searches for end of block inserts a label and generates a jump to it.

Subtopic: replacements for macros up

Quote: use 'const', 'inline', and 'template' in place of macros and C's preprocessor constructs

Subtopic: history up

Quote: an open subroutine is copied as is to a program; a closed subroutine is called from the master routine with a Wheeler jump [»wilkMV_1951]
Quote: Tech Assembly System provided macros and an expansible library of subroutines [»perlAJ2_1959]
Quote: Tech Assembly System provided macro instructions for useful combinations of machine code

Related Topics up

Group: function   (12 topics, 232 quotes)
Group: parameters   (10 topics, 145 quotes)

Topic: binding names to variables or expressions (10 items)
Topic: case frame grammar (5 items)
Topic: compile-time execution (17 items)
Topic: conditional compilation (1 item)
Topic: definition languages (3 items)
Topic: function definition (25 items)
Topic: generic operations and polymorphism (67 items)
Topic: generated variable (7 items)
Topic: in-line code (7 items)
Topic: keyboard macros (12 items)
Topic: language extension via macros (23 items)
Topic: macro syntax definition (10 items)
Topic: named constants and expressions (21 items)
Topic: names as place holders (4 items)
Topic: object-oriented templates and containers (27 items)
Topic: parameter passing by name (11 items)
Topic: pronoun reference (23 items)
Topic: scripting language (27 items)
Topic: semantic grammar (23 items)
Topic: stepwise refinement (25 items)
Topic: string transformation languages (17 items)
Topic: structured editors (35 items)
Topic: user-defined languages (42 items)
Topic: words defined by words
(25 items)

Updated barberCB 8/04
Copyright © 2002-2008 by C. Bradford Barber. All rights reserved.
Thesa is a trademark of C. Bradford Barber.