From: Sebastien F4GRX <f4grx@f4grx.net>
To: Angelo Papenhoff <aap@papnet.eu>, tuhs@tuhs.org
Subject: [TUHS] Re: Software written in B
Date: Mon, 19 Jun 2023 12:18:45 +0200 [thread overview]
Message-ID: <b4830497-0e5d-13ee-23e5-814afd079f14@f4grx.net> (raw)
In-Reply-To: <af0ca006-8f0d-bbd2-2281-e9398fd053f4@f4grx.net>
Hi,
Sorry for my previous message, my analysis is wrong.
The return value is still a typo, but this expression should not pose a
problem, the AST shows that the postinc has priority, uses a legit
lvalue, which result is multiplied by zero.
This was probably not intended but syntactically correct.
I have added better error identification and now I see that my problem
is in exp(s)
nextarg()[0] is refused.
because nextarg() is not a lvalue, as expected by the indexing operation.
I need to update my code generator so that any expression left of an
index is accepted (and used as an address).
Sebastien
Le 19/06/2023 à 11:52, Sebastien F4GRX a écrit :
> 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).
next prev parent reply other threads:[~2023-06-19 10:19 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-07 10:14 [TUHS] " Sebastien F4GRX
2023-06-07 10:38 ` [TUHS] " Lars Brinkhoff
2023-06-07 15:05 ` Angelo Papenhoff
2023-06-07 15:57 ` Clem Cole
2023-06-07 16:21 ` Lars Brinkhoff
2023-06-07 17:26 ` Bakul Shah
2023-06-07 18:16 ` Phil Budne
2023-06-07 23:49 ` Andrew Hume
2023-06-08 2:10 ` segaloco via TUHS
2023-06-08 3:31 ` Phil Budne
2023-06-08 15:05 ` segaloco via TUHS
2023-06-14 11:51 ` Angelo Papenhoff
2023-06-14 20:03 ` Angelo Papenhoff
2023-06-14 21:53 ` segaloco via TUHS
2023-06-14 22:05 ` Angelo Papenhoff
2023-06-15 8:00 ` Sebastien F4GRX
2023-06-15 8:21 ` Angelo Papenhoff
2023-06-15 8:33 ` Sebastien F4GRX
2023-06-17 8:19 ` Angelo Papenhoff
2023-06-19 9:52 ` Sebastien F4GRX
2023-06-19 10:18 ` Sebastien F4GRX [this message]
2023-06-19 10:48 ` Lars Brinkhoff
2023-06-19 10:55 ` G. Branden Robinson
2023-06-19 11:07 ` Sebastien F4GRX
2023-06-19 18:44 ` segaloco via TUHS
2023-06-23 10:59 ` Angelo Papenhoff
2023-06-23 13:32 ` Sebastien F4GRX
2023-06-23 14:01 ` Angelo Papenhoff
2023-06-23 14:14 ` Sebastien F4GRX
2023-06-23 14:39 ` Angelo Papenhoff
2023-06-23 14:10 ` Sebastien F4GRX
2023-06-23 14:49 ` Angelo Papenhoff
2023-06-23 15:31 ` Sebastien F4GRX
2023-06-23 15:36 ` Angelo Papenhoff
2023-06-23 15:53 ` Sebastien F4GRX
2023-06-08 14:41 ` arnold
2023-06-09 8:56 ` Sebastien F4GRX
2023-06-09 9:57 ` Lars Brinkhoff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b4830497-0e5d-13ee-23e5-814afd079f14@f4grx.net \
--to=f4grx@f4grx.net \
--cc=aap@papnet.eu \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).