Premium
A pattern matching macro processor
Author(s) -
Sassa Masataka
Publication year - 1979
Publication title -
software: practice and experience
Language(s) - English
Resource type - Journals
SCImago Journal Rank - 0.437
H-Index - 70
eISSN - 1097-024X
pISSN - 0038-0644
DOI - 10.1002/spe.4380090604
Subject(s) - macro , computer science , programming language , notation , string (physics) , matching (statistics) , reading (process) , arithmetic , linguistics , mathematics , philosophy , mathematical physics , statistics
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.