Hello,
my own compiler choked on if.b and mail.b because of this invalid
expression in nxtarg:
if(ap>ac) return(0*ap++);
I believe it should instead read:
if(ap>ac) return 0;
What do you think about this?
PS: The original code gives this AST which shows how my compiler
interprets this source :
function name nxtarg
. env: ref to function nxtarg
. env: ref to function main
. compound stmt
. . env: extern ap
. . env: extern ac
. . env: extern argv
. . env: ref to function nxtarg
. . env: ref to function main
. . if test
. . . operation: GT
. . . . extern declaration ap
. . . . extern declaration ac
. . then stmt
. . . return stmt
. . . . operation: MUL
. . . . . value: 0
. . . . . operation: POSTINC
. . . . . . extern declaration ap
. . return stmt
. . . [LVALUE] operation: INDEX
. . . . extern declaration argv
. . . . operation: POSTINC
. . . . . extern declaration ap
Sebastien
Le 17/06/2023 à 10:19, Angelo Papenhoff a écrit :
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).