re vs. sgmllib (was: Moving from Perl to Python)

Bob Horvath bob at horvath.com
Tue Sep 28 23:03:54 EDT 1999


Tim Peters wrote:

> [Jon Fernquest]
> > Since regular expressions are just a short-hand way of specifying
> > (practically only *some*) regular languages whereas finite state
> > machines can specify any regular language the next logical step
> > would be a set of finite state tools like those that Xerox sells
> > (for several thousands of dollars I might add).
>
> Then I hope we can skip the next logical step and leapfrog illogically to a
> real parser <wink>.  Part of the problem here is that what people want to
> parse these days-- from programming language fragments to SGML --isn't
> regular.  That doesn't stop them from trying to do it with regexps, and
> input-sensitive bug-ridden code is the result.  Heck, most people find it a
> challenge to write a correct regexp to match a Python string -- or even a C
> /**/ comment.  Not that regular languages aren't useful, but I expect their
> appropriate non-trivial applications will always be a wizard art.

I have not had the time to check out the Python parsers as much as I would
like, but I have played around with JavaCC and liked it.  If there were
something in Python that was similar to JavaCC, this would be very nice.  None
of the Python parsers seem to jump out as being "the one to use". Perhaps
I need to spend some more time - a nudge in the right direction would be
appreciated?

>
> Note that Perl is in the process of adding recursive "regexps".
>
> the-mind-boggles-ly y'rs  - tim

Recursive regexps?  Yikes!





More information about the Python-list mailing list