Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Announcement: CL-PPCRE

5 views
Skip to first unread message

Edi Weitz

unread,
Dec 20, 2002, 6:24:25 AM12/20/02
to
OK, you think that Lispers rarely, if ever, need regular expressions?
You think that there are already enough high-quality regex packages
for CL out there? You think that Perl ain't exactly a good role model
for syntax? Well, there's no need to argue with me - I share your
opinions.

Nevertheless, the code that I'm going to announce here is the result
of a bet and as it now looks quite useful to me I though I could as
well publish it. So here we go:

CL-PPCRE is a portable regular expression library for Common Lisp
which has the following features:

* It is compatible with Perl. It even correctly parses and applies
Jeffrey Friedl's famous 6600-byte long RFC822 address pattern.

* It is fast. If compiled with CMUCL it outperforms Perl's highly
optimized regex engine (written in C) which to my knowledge is
faster than most other regex engines around.

* It is portable, i.e. the code aims to be strictly
ANSI-compliant. It has been successfully tested with CMUCL,
SBCL, SCL, CLISP, LW, ACL, MCL, and OpenMCL on various operating
systems.

* It is thread-safe.

* It comes with convenient features like a SPLIT function, a
couple of DO-like loop constructs, and a regex-based APROPOS
feature similar to the one found in Emacs.

* In addition to specifying regular expressions as strings like in
Perl you can also use S-expressions which obviously is more
Lisp-y.

* Is it is fully documented so I might have a chance to understand
my own code in about six months... :)

* It comes with a BSD-style license so you can basically do with
it whatever you want.

More details and the code itself can be found at

<http://weitz.de/cl-ppcre/>

Please send bug reports, critique, or patches to <e...@agharta.de>.

Nils Goesche

unread,
Dec 20, 2002, 12:32:30 PM12/20/02
to
Edi Weitz <e...@agharta.de> writes:

> Nevertheless, the code that I'm going to announce here is the

> result of a bet...


>
> CL-PPCRE is a portable regular expression library for Common
> Lisp which has the following features:

Got a clean compile (LWL) and everything seems to work fine.
Very cool, thanks for this!

Did you win the bet? :-)

Regards,
--
Nils Gösche
Ask not for whom the <CONTROL-G> tolls.

PGP key ID #xD26EF2A0

Edi Weitz

unread,
Dec 20, 2002, 1:20:39 PM12/20/02
to
Nils Goesche <n...@cartan.de> writes:

> Got a clean compile (LWL) and everything seems to work fine. Very
> cool, thanks for this!
>
> Did you win the bet? :-)

Yes... :)

Alan Walker

unread,
Dec 20, 2002, 7:14:14 PM12/20/02
to
What was the bet?

Alan.


"Edi Weitz" <e...@agharta.de> wrote in message
news:87smwt9...@bird.agharta.de...

Edi Weitz

unread,
Dec 20, 2002, 7:33:23 PM12/20/02
to
"Alan Walker" <alan-walker-...@charter.net> writes:

> What was the bet?

That is was possible to write a regex parser in CL that is compatible
with Perl and at least as fast. You know, the usual stuff that starts
with "But isn't Lisp slow, old and only used for AI research?"...

I admit I got carried away a bit. The most difficult part was to write
a parser to grok Perl's regex syntax and if you look at my code it
shows.

Now, CL-PPCRE isn't 100% Perl-compatible (which I claim no program can
be, not even Perl[1]) and there are a few cases where Perl is faster
than CMUCL/CL-PPCRE but we agreed that I had won... :)

Cheers,
Edi.

[1] See for example the first three cases in

<http://weitz.de/cl-ppcre/#perl>.

Alan Walker

unread,
Dec 20, 2002, 10:00:12 PM12/20/02
to
Edi,

Excellent results and congrats on winning your bet. I may use your example
at work to explain to people why Lisp isn't slow. I enjoy programming in
Lisp, but that shouldn't surprise people in this newsgroup. I'm probably
more proficient in C++, 'cause that's what we have to use at work, but I
always feel like I'm fighting the compiler the whole way. Despite that, I
can develop and test new algorithms faster in Lisp.

What did you win? Something more than bragging rights?

Alan.


"Edi Weitz" <e...@agharta.de> wrote in message

news:87ptrwk...@bird.agharta.de...

Edi Weitz

unread,
Dec 21, 2002, 5:02:43 AM12/21/02
to
"Alan Walker" <alan-walker-...@charter.net> writes:

> I may use your example at work to explain to people why Lisp isn't
> slow.

Feel free to do so. But you know that there are much more examples
like that around. See for example Pierre R. Mai's MD5 implementation,
some of the "add-a-gram" solutions that were posted to this newsgroup,
or some of the stuff from the "programming language shoot-out".

> What did you win? Something more than bragging rights?

Unfortunately not... :)

Cheers,
Edi.

0 new messages