Then there is Arthur Whitney's B language. This is a *completely*
different beast from Ken Thompson's B.
https://web.archive.org/web/20160505183405/http://kparc.com/b/
Here's binary search in it:
b[Ii]{h:#x;l:0;while(h>l)$[y>x[i:/l+h];l:i+1;h:i];l}
for comparison here it is in C:
I b(I*x,I y){I h=x[-1],i,l=0;while(h>l)if(y>x[i=l+h>>1])l=i+1;else h=i;R
l;}
[B is modeled after his K language, hence the extreme terseness]
Perhaps not most people's cup of tea but certainly interesting. Too bad
no one else has dared to pick it up! :)/2
On Jun 7, 2023, at 3:14 AM, Sebastien F4GRX
<f4grx(a)f4grx.net> wrote:
So for fun and self-education, I am now writing a (or yet another) B compiler, in C,
after reading Jack Crenshaw's "Let's build a compiler" documentation (
https://compilers.iecc.com/crenshaw/ )
Here it is:
https://git.sr.ht/~f4grx/bpars