implementation for Parsing Expression Grammar?
Kay Schluehr
kay.schluehr at gmx.net
Sat May 10 09:41:36 EDT 2008
On 10 Mai, 07:52, "xah... at gmail.com" <xah... 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.
Well formed XML cannot be fully specified within BNF as well because
it is context sensitive: in order to recognize a tag/endtag pair one
has to maintain a stack. That's not a big deal in practice if one
wants to write an XML parser but one can't use an arbitrary LL or LR
parser generator to produce a parse tree representing the XML.
More information about the Python-list
mailing list