[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: yet another pattern-matching library for Lua
- From: roberto@... (Roberto Ierusalimschy)
- Date: Wed, 27 Dec 2006 14:43:34 -0200
I am releasing a prototype of (yet) another pattern-matching
library for Lua, called LPeg:
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):
- 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