Version 9 of m4

Updated 2014-01-20 13:19:27 by pooryorick

m4 is a general-purpose string substitution language. It provides a more general macro facility than the C preprocessor, first really publicised as the macro processor for Ratfor in the book Software Tools. It's a sophisticated language, but tricky to use because there's no unique substitution symbol to distinguish macros from ordinary running text.

Description

GNU m4 is the de-facto standard implementation. The manual can be found at [L1 ].

textutil::expand is a Tcl-based alternative


DKF: M4 is Turing-Complete, but only really used for autoconf hacking now (and that's a fairly heavily modified version).

Peter da Silva: It's also used in sendmail for automating the generation of config files.

Back around '82, after I left Berkeley, I was using RSX-11 and feeling UNIX-starved. I took a copy of Software Tools and implemented everything in it from Ratfor through ed. When I implemented macro I renamed all the internal symbols so they began with a dollar sign. This made a huge difference in the usability of the language.


LV: So, are there enough benefits to m4 to make it worth a developer's time to use it with Tcl to write sort of metacode, which would be expanded before execution?

In May 2005, Lars H suspects the answer is: "No, it's not worth it. But since m4 happened to be in the right place at the right time (the birth of autoconf), it has become canonized."

AMG: Kinda like Java and Flash on the Web?


escargo 2005-05-28: I once received several technical reports (I believe from Bell Labs, but I could be wrong) about different software they had made available, and one of them was for the m6 macro processor. I don't know how m4 and m6 differred (nor what happened to m5), but I used to be an avid follower of macro language development (primarily for the purposes of software portability). Anybody else remember anything about m6?


AMG: I like to think that "m4" is a silly abbreviation for "macro", in the same way that "l10n" and "i18n" are abbreviations for "localization" and "internationalization". I also like to think that "L-3" (the name of my company) is an abbreviation for "Link" (the name of my division), even though it's not actually true. ;^)