We are hiring

pregexp over streams, and other random hackery

Over at eighty-twenty I recount a couple of recent random excursions into various bits and pieces of code.

Besides those developments, I also spent some time on Sunday morning modifying Dorai Sitaram‘s pregexp version 20050502 to operate
over streams as well as strings, so that I could use it for lexing
arbitrary character sources (for instance, with the packrat parser library I’ve been developing).

I’ve also added a procedure pregexp-match-head, which is likepregexp-match-positions except it only matches at the very beginning of
the input string or stream; pregexp-match-head behaves like Python’sre.match, where pregexp-match-positions behaves like Python’s re.search.

I haven’t modified pregexp-split, pregexp-replace, or pregexp-replace*,
partly because I have no need for them for my application and partly
because I’m not sure what their behaviour should be: shouldpregexp-replace, when given a stream, answer a stream, or a string? In
the case of pregexp-split, since it has to examine the entire input in
any case, supporting streams seems unnecessary. (Perhaps I should have
included a pregexp-stream->string utility, though.)