[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: yet another pattern-matching library for Lua
- From: Brian Hagerty <Brian.Hagerty@...>
- Date: Wed, 03 Jan 2007 09:54:30 -0800
One thing to keep in mind about LPEG, it's not just "another
pattern-matching library" on par with regular expression parsers
and string manipulation libraries.
LPEG is (or is on its way to be) a full /Parsing Expression
Grammar/ library, fully capable of expressing and implementing
Grammars, as well as Regular Expressions. RegExps are very
limited kinds of pattern languages (typically limited to
recognizing lexical tokens).
RegExps cannot express the much more complex syntax of Context
Free Grammars (CFGs), Context Sensitive Grammars (CSGs), and
Parsing Grammars (PGs, aka PEG: Parsing Expression Grammars).
PEGS are a kind of context-sensitive grammar, which are a proper
superset of CFGs, which in turn are a superset of RegExps.
...
If any of you haven't already done so, and you have an interest
in or need for the broader applications of Grammars over
RegExps, check out Roberto's LPEG pages and Bryan Ford's PEG pages:
http://www.inf.puc-rio.br/~roberto/lpeg.html
http://pdos.csail.mit.edu/~baford/packrat/
// Brian
Philippe Lhoste wrote:
Funnily, I recently thought it would be nice to have a real
pattern-matching language, that would be more flexible and more
readable, with a gentler learning curve than regular expressions.
I am not too sure about the readability of LPeg... But it is close of
what I had in mind.
I didn't knew this PEG technology, it looks very promising.
Now that I master regular expressions, I have to learn a new syntax and
even more new concepts/way of thinking...