KBD

Keith Devens .com

Tuesday, March 16, 2010 Flag waving
... it's a lot faster to not do something than to do it. – Dan Sugalski
← C# 4.0Reworking My UI « A Dwarf Priest →

Daily link icon Friday, November 21, 2008

Gema, the general purpose macro processor

Gema:

gema is a general purpose text processing utility based on the concept of pattern matching. In general, it reads an input file and copies it to an output file, while performing certain transformations to the data as specified by a set of patterns defined by the user. It can be used to do the sorts of things that are done by Unix utilities such as cpp, grep, sed, awk, or strings. It can be used as a macro processor, but it is much more general than cpp or m4 because it does not impose any particular syntax for what a macro call looks like. Unlike utilities like sed or awk, gema can deal with patterns that span multiple lines and with nested constructs. It is also distinguished by being able to use multiple sets of rules to be used in different contexts.

Another neat feature is that it has bindings to Lua that let you run arbitrary Lua code to operate on the result of a match.

I came across Gema years ago, but while I've never had the opportunity to use it for anything, I kept it in the back of my mind as an interesting project. I've been wondering how similar what it does is to Perl 6 grammars, so I've been meaning to check out Gema again, although I couldn't remember the name until just now.

← C# 4.0Reworking My UI « A Dwarf Priest →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

March 2010
SunMonTueWedThuFriSat
 123456
78910111213
14151617181920
21222324252627
28293031 



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 1 posts

Recent comments XML

Quantum physics and free will

I knew you were going to say that....

Tom Massey: Mar 15, 9:26pm

Generated in about 0.131s.

(Used 8 db queries)