General purpose macro processor

General purpose macro processor

A general purpose macro processor is a macro processor that is not tied to, or integrated with, a particular language or piece of software.

In its simplest form, a macro processor is a program that copies a stream of text from one place to another, making some kind of systematic set of replacements as it does so. Macro processors are often embedded in other programs (for example, many assembler programs incorporate a macro processor, and the C language mandates the presence of a preprocessor which incorporates some crude macro processing facilities).

However, macro processors may also be stand alone programs, which means that it is easy to use them for processing any kind of text at all.

General purpose macro processors can be used for many tasks; they have been used for language expansion (defining new language constructs that can be expressed in terms of existing language components), for systematic textual replacements that require some kind of decision making (where a global edit would be insufficient), and for textual reformatting (e.g. conditional extraction of material from an HTML file).

Examples of general purpose macro processors

One of the earliest macro processors was GPM (the "General Purpose Macrogenerator") [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 ] . This was developed at the University of Cambridge, UK, in the mid 1960s.

One particularly important general purpose macro processor was (and still is) ML/I ("Macro Language One"). This was developed as part of PhD research by a Cambridge postgraduate, Peter J. Brown. ML/I operates on a character stream, and requires no special format for its input, nor any special flag characters to introduce macros.

A contemporary of ML/I was STAGE2, part of William Waite's "Mobile Programming System". This too is a general purpose macro processor, but it processes input a line at a time, matching each line against specified patterns.

[http://gema.sourceforge.net gema] is a contextual macro processor based on pattern matching. It replaces/enhances the concept of regular expressions by contexts. Contexts roughly corresponds to named sets of patterns. As a consequence, macros in gema closely resemble an EBNF description.

[http://en.nothingisreal.com/wiki/GPP gpp] is another general macro processor written by Denis Auroux. It resembles a C preprocessor, but has more general semantics and allows for customized syntax (for instance, TeX, XHTML, and Prolog-like scripts are definable).

XPOP was another attempt at a general macro processing language by Mark Halpern at IBM in the 60's.

m4 was designed for Unix by Brian Kernighan and Dennis Ritchie.

SNOBOL is a string processing language which is capable of doing most of the pre-processing which can be done by a macro processor.

ELENASoftware: Practice and Experience, Vol. 14, pp. 519-531, Jun. 1984Macro definition

header:a sequence of keywords and parameter markers (%)at least one of the first two tokens in a macro header must be a keyword, not a parameter marker

body: the character & identifies a local labelmacro time instruction (.SET, .IF .JUMP, .E)macro time variables or labels (.)

External links

* [http://www.ml1.org.uk ML/I web site]
* [http://gema.sourceforge.net Gema homepage]
* [http://en.nothingisreal.com/wiki/GPP GPP's homepage]

References


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • Macro (computer science) — A macro (from the Greek μάκρο for long or far) 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)… …   Wikipedia

  • Microsoft Macro Assembler — Developer(s) Microsoft Stable release 10.0.30319.1 / April 12, 2010; 18 months ago (2010 04 12) Operating system Microsoft Windows and MS DOS …   Wikipedia

  • Network processor — A network processor is an integrated circuit which has a feature set specifically targeted at the networking application domain. Network processors are typically software programmable devices and would have generic characteristics similar to… …   Wikipedia

  • Preprocessor — In computer science, a preprocessor is a program that processes its input data to produce output that is used as input to another program. The output is said to be a preprocessed form of the input data, which is often used by some subsequent… …   Wikipedia

  • M4 (computer language) — m4 is a general purpose macro processor designed by Brian Kernighan and Dennis Ritchie. The name m4 stands for macro, i.e. m plus 4 characters.UseA macro processor (or a preprocessor) is a text replacement tool. Its chief use is to re use text… …   Wikipedia

  • GPM — can mean:*GPM (software) (General Purpose Mouse), a mouse server for the console and xterm *Gallons per minute, a unit of volumetric flow rate *General purpose macro processor, an type of macro processor *Geopotential meter, a unit of… …   Wikipedia

  • Data General — Industry Computer Fate Acquired Successor EMC Corporation Founded 1968 …   Wikipedia

  • ML/I — ML/1 (Macro Language/One) is a powerful general purpose macro processor. Typical uses of ML/1 include: editing, modifying, correcting, or reformatting text files translating source code from one programming language to another acting as a source… …   Wikipedia

  • GEMA — may be:* Georgia Emergency Management Agency * gema , a General Purpose Macro Processor * GEMA (Germany), a performance rights organisation * The Gas and Electricity Markets Authority in the United Kingdom * Global Engine Manufacturing Alliance,… …   Wikipedia

  • Условная компиляция — В информатике, препроцессор  это компьютерная программа, принимающая данные на входе, и выдающая данные, предназначенные для входа другой программы, например, такой как компилятор. О данных на выходе препроцессора говорят, что они находятся в… …   Википедия

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”