announcing "gema" - the general purpose macro processor

gray@rigel.inse.com (David N Gray)
Sun, 26 Mar 1995 00:17:06 GMT

          From comp.compilers

Related articles
announcing "gema" - the general purpose macro processor gray@rigel.inse.com (1995-03-26)
| List of all articles for this month |

Newsgroups: comp.compilers
From: gray@rigel.inse.com (David N Gray)
Keywords: macros, available
Organization: INS Engineering, Mountain View, CA
Date: Sun, 26 Mar 1995 00:17:06 GMT

I have created a text processing utility that I would like to donate to the
public domain as I think others might find it useful also. The basic
concept is that the user provides a set of rules that use pattern matching
to specify the transformation of the input file(s) to the output file(s).
Each rule consists of a template to be matched against the input text and a
corresponding action that produces replacement text. (This approach was
inspired by W. M. Waite's STAGE2 processor, but it also has some
similarities to "awk".) Text that doesn't match any pattern is copied
unchanged, or optionally omitted.


This provides a very general purpose mechanism that can be used for a
number of purposes:


    * As a macro pre-processor, it can do macro substitutions like "cpp" or
        "m4", but is more general because it does not impose any particular
        syntax for what a macro call looks like.


    * It can search for and display selected information like "grep", but it
        has the advantage of being able to recognize patterns that span
        multiple lines, and can use more complicated selection criteria.


    * It can do many of the kinds of text manipulations typically done by
        "sed" or "awk", but it can handle multiple-line constructs and nested
        constructs, such as properly matching pairs of nested parentheses.


    * It can be used to implement translators for converting information from
        one programming language or data representation to another. Some
        features that facilitate this include:
* No built-in assumptions about the language syntax.
* There can be multiple sets of rules for different contexts. For
example, comment bodies can be processed by a separate set of
rules from those for program code.
* Ignoring redundant whitespace is easy.


I have used this to implement translators to HTML from LaTeX and "nroff".


Complete documentation can be viewed at URL:
file://ftp.inse.com/pub/gema/www/top.html
The program, documentation, and examples may be obtained by anonymous FTP
from "ftp.inse.com" in directory "/pub/gema"/. The program is written in
ANSI C and works on both Unix and MS-DOS.


However, this is a very limited time offer! This network node is going
away March 31. I would appreciate it if someone can offer a more permanent
home for this program.


-- David N. Gray DGray@acm.org
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.