implementation for Parsing Expression Grammar?

George Neuner gneuner2/ at /comcast.net
Sat May 10 21:26:54 EDT 2008


On Fri, 9 May 2008 22:52:30 -0700 (PDT), "xahlee at gmail.com"
<xahlee at gmail.com> wrote:

>In the past weeks i've been thinking over the problem on the practical
>problems of regex in its matching power. For example, often it can't
>be used to match anything of nested nature, even the most simple
>nesting. It can't be used to match any simple grammar expressed by
>BNF. Some rather very regular and simple languages such as XML, or
>even url, email address, are not specified as a regex. (there exist
>regex that are pages long that tried to match email address though)

What's your point?  The limitations of regular expressions are well
known.

>After days of researching this problem, looking into parsers and its
>theories etc, today i found the answer!!
>
>What i was looking for is called Parsing Expression Grammar (PEG).

PEG has its own problems - it's very easy with PEG to create subtly
ambiguous grammars for which quite legal looking input is rejected.
And there are no good tools to analyze a PEG and warn you of subtle
problems.

Chris Clark (YACC++) has posted at length about the merits, problems
and limitations of various parse techniques - including PEG - in
comp.compilers.  Before you consider doing anything with PEG I suggest
you look up his posts and read the related threads.


>It seems to me it's already in Perl6, and there's also a
>implementation in Haskell. Is the perl6 PEG is in a usable state?
>
>Thanks.
>
>  Xah
>  xah at xahlee.org
>? http://xahlee.org/

George
--
for email reply remove "/" from address



More information about the Python-list mailing list