A pattern matching macro processor
Masataka Sassa · Software Practice and Experience · 1979
Abstract A general‐purpose pattern matching macro processor is described. Macro patterns can be defined using regular expressions. Macro calls are treated by balancing pattern matching at the token unit level, allowing options, alternatives and repetition. Thus, text in a language with a nested structure can be dealt with. In a macro body, Algol‐style macro‐time operations are allowed, which improves writing and reading. Our macro processor can also be used as a tool for language conversion since it incorporates a feature to declare language‐dependent constructs such as comments, string notations and parentheses pairs. Although our macro processor is not biased towards any particular language, it has successfully converted an Algol 68‐style text into a Fortran text. Problems of language conversion using macros are briefly discussed based upon the experience obtained through this macro processor.