[TUHS] Software written in B

Sebastien F4GRX f4grx at f4grx.net
Sat Jun 24 00:10:11 AEST 2023

Hi again,

OK I found your compiler project on github: https://github.com/aap/b

I see you have introduced changes like this one:

-       auto ab[500], ava[150];
-       auto dirf, string, av, name[5], s;
+       auto ab 1000, ava 150;
+       auto dirf, string, av, name 5, s;

So it mean that at some point the auto declaration was changed?

Oh, yes it was. Here is the original syntax : 

And this one describes the use of quotes for auto arrays, but thats for 
the H6070! https://www.bell-labs.com/usr/dmr/www/bref.pdf

Also in bref, auto a[4] reserves 5 words, but in ken's version auto a 4 
reserves 4 words.

I think I will make a command line option to support both language specs :)

And fix my code, because I had found this example 

and was convinced that constants in auto were initial values, but I now 
understand that this is incorrect.

Initialized auto variables would have been an avoidable syntactic sugar 
on these machines!



Le 23/06/2023 à 12:59, Angelo Papenhoff a écrit :
> Another update: I have worked quite a bit on my compiler
> the last couple of days and have managed to make it produce the same
> code as those in the binaries (compared the intermediate code by eye).
> There were a few mistakes, the files have been updated.
> I removed some features that I figured were not in ken's original
> compiler and most importantly changed it to generate RPN code directly
> instead of parsing an expression into a tree and generating code from
> that, which ken confirmed was how it worked.
> I'm still not entirely happy with the result (the build() function seems
> a bit kludgy), but at least it seems to produce something accurate.
> Unfortunately I have no idea what the intermediate would have looked
> like, so the output of this is purely my fantasy.
> I will also have to adjust my take on ba now due to the changes.
> For anyone interested, this is my WIP version of bc.b:
> https://gist.github.com/aap/6df9b4c53c63592437d97dadab533649
> aap
> On 17/06/23, Angelo Papenhoff wrote:
>> Update: I'm now done with the first pass of this.
>> I reversed all the programs and successfully ran them through my
>> compiler (i haven't assembled or linked anything though).
>> http://squoze.net/B/programs/
>> To check for correctness, the files should of course be compiled,
>> assembled and linked again. Unfortunately my compiler currently
>> does not generate quite the same code as the original one. I will
>> have to work on this.
>> Most importantly & and | are only bitwise operators in the version
>> of B that compiled these programs, but some other differences (like
>> the fixup chain and the way strings are stored) exist too.
>> It would be nice to have a fully working B system on v1/v2 UNIX again,
>> with everything built from source, we can even reconstruct different
>> versions of the runtime (and perhaps standard library). So far the
>> PDP-11 version of my B system has only run on v6 and 2.11BSD.
>> best,
>> aap
>> On 14/06/23, Angelo Papenhoff wrote:
>>> I will hopefully continue with this in the next time (if, goto, mail and
>>> glob are left).

More information about the TUHS mailing list