regular expressions questions

Andrew M. Kuchling akuchlin at mems-exchange.org
Mon Mar 27 15:56:35 CEST 2000


Derek Thomson <derek at ooc.com.au> writes:
> Really? I couldn't find anything that was even half as good as Perl's
> Parse::RecDescent, after doing some searching from python.org. Links?

Try starting at http://starship.python.net/crew/amk/python/string.html#parsing .
(I should really do a Text Processing topic guide someday.)

> There is a large class of parsing applications for which writing an entire
> grammar is overkill (or too much CS background is needed for the user. cp4e?),

I'm doubtful regular expressions are better for CP4E's audience than a
fairly simple parser generator such as, say, John Aycock's SPARK.
Consider how many people are confused by the fact that <p>.*</p> does
a greedy match and matches all of '<p>para1</p><p>para2</p>'.  And
didn't SNOBOL provide string processing features that were powerful
but still usable by non-programmers?  (But my memory's fuzzy.)

> I'm sure a decent syntax could be devised with a little thought. After all, the
> named subexpression idea is very good, and a great improvement over Perl's
> numbering system ie $1, $2 etc.

Suggestions would be welcomed, and could rescue the idea from
oblivion.  Feel free to post a proposed syntax; we can then refine it
through further discussion.

-- 
A.M. Kuchling			http://starship.python.net/crew/amk/
Calm before the storm. Form is emptiness. Emptiness form.
  -- _The Man Who Mistook His Wife for a Hat_, music Michael Nyman, libretto
       Christopher Rawlence




More information about the Python-list mailing list