I am releasing a prototype of (yet) another pattern-matching
library for Lua, called LPeg:
http://www.inf.puc-rio.br/~roberto/lpeg.html
Because the library is rather unconventional, all things in it are
experimental (even its name).
Unlike most pattern-matching libraries, LPeg is not based on regular
expressions, but on Parsing Expression Grammars (which in turn are based
on TDPLs, a technique using top-down parsers with limited backtracking
developed in the 70s):
Why LPeg?
- It seems to be quite efficient.
- It has a simple implementation; patterns are translated to programs
for a small parsing machine.
- It is quite complete. Besides the usual pattern-matching operators
based on regular expressions (alternation, concatenation, and
repetition, but with a twisted semantics), it also supports BNF-like
grammars (again with a twisted semantics; see the docs).
- It has a formal ground. (Unlike most pattern-matching libraries today,
which are ad-hoc collections of facilities loosely inspired by regular
expressions.)
Have fun!
-- Roberto