[TUHS] forth on early unix
Rob Pike via TUHS
tuhs at tuhs.org
Mon Sep 22 20:00:37 AEST 2025
That's the one, yes. Brian Kernighan wrote an exegesis of it that became
the first chapter of the book Beautiful Code. He didn't say enough about
its potentially pathological performance, but then it was pretty much the
same algorithm as what ed(1) did, and unlikely to occur in non-brutal
practice.
I wrote the well-behaved, truly linear one in sam, which presotto extracted
to create the Plan 9 regexp library. I did the early Go library, but Russ
replaced it with a much more efficient, capable and (for better or worse)
modern implementation. Those are the only two that saw the light of day,
although I also made some "improvements" (i.e., non-regular additions) to
the ed code when working on qed, some of which landed unattributed in vi.
-rob
On Mon, Sep 22, 2025 at 6:05 PM Thalia Archibald <thalia at archibald.dev>
wrote:
> On Sep 21, 2025, at 21:23, Rob Pike wrote:
> > I wrote a lot of forth as a student programming radio telescopes, often
> > inside the telescope base itself. That was a thing back then, much to my
> > surprise. The regexp implementation BWK has celebrated was likely rooted
> in
> > a similar thing I did one hot summer day baking underneath a dish,
> annoyed
> > at the difficulty of doing what I wanted to do. That version fit inside a
> > 512-byte block (that was a forth thing back then), probably two or three
> > times over.
>
> Rob,
>
> Which regexp implementation was that? It sounds like one I haven't heard
> of. Are
> you referring to the one in The Practice of Programming that you did with
> bwk?
> Besides that, I know you wrote the ones for sam and Go; were there others?
> I've
> been working on tracing historical development of regexp engines
> (https://github.com/thaliaarchi/regexp-museum) and would be interested in
> any
> you were involved with.
>
> Thanks,
> Thalia
>
More information about the TUHS
mailing list