[Oberon] LOOP conversion
Frans-Pieter Vonck
fp at vonck.nl
Thu Jan 7 13:47:17 CET 2021
In Oberon Steps Beyond Pascal And Modula:
"[..]we formally define the control structures by means of predicates
and their transformation rules."{pg. 47, Chapter 5: Control Structures.
"The danger of using the repeat statement lies in the fact, that the
statement sequence is not guarded by an explicit condition.[..] In
general it is wise to use the WHILE statement whenever REPEAT does not
offer a clear advantage." (pg.58)
Interesting is that the LOOP statement is not formally defined in this
book, see 5.2.5.
Probably due tot the fact that there are multiple exits.
Also the FOR statement is not formally defined (pg. 273).
It is possible I've overlooked some good explanations about this
subject.
What is your favorite examples of formal definitions of control
structures in Wirth's work?
Grts,
F.P.
Chris Burrows schreef op 2021-01-07 07:16:
>> -----Original Message-----
>> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
>> Skulski, Wojciech
>> Sent: Thursday, 7 January 2021 1:53 PM
>> To: ETH Oberon and related systems
>> Subject: Re: [Oberon] [EXT] LOOP conversion
>>
>> Andreas:
>>
>> >I have a sneaking suspicion that the participants in this discussion
>> >have (probably?) already spent more time on this question than the
>> time
>> >it would take to add LOOP to the compiler ;-)
>>
>> I would if I could. But there are some limits to my knowledge and
>> skills. I know how to do many things, but not this one.
>>
>> Other users are in a similar situation. Not every user is capable to
>> define a language and to implement or change the compiler.
>>
>> We are at your mercy.
>>
>
> I believe in that clichéd quote "Give a man a fish and you feed him for
> a
> day. Teach a man to fish and you feed him for a lifetime".
>
> How much of your time would you be prepared to invest to learn how to
> add
> LOOP and multiple EXITs to Wirth's published Project Oberon Oberon-07
> compiler?
>
> If you give a reasonable answer I am prepared to give you (and anybody
> else
> watching this list) step by step instructions of the approach you can
> take
> to achieve it. As far as compiler modifications go it is relatively
> straightforward. The completed exercise consists of approximately 20
> additional statements in two of the compiler modules and makes use of
> existing code generation procedures. Once you have completed those
> steps you
> should have learnt enough to be able to add multiple RETURNs as well
> with
> little or no assistance and to make similar changes to Andreas's source
> code
> if you want to build on that instead.
>
> Step 1. Prepare an environment to allow you to edit the compiler source
> code, compile it and execute it.
>
> I expect that you will find it to be a very empowering exercise. The
> only
> fear I have is that once "the genie is out of the bottle" there will be
> no
> putting it back ;-)
>
> Regards,
> Chris Burrows
> https://www.astrobe.com
>
>
> --
> Oberon at lists.inf.ethz.ch mailing list for ETH Oberon and related
> systems
> https://lists.inf.ethz.ch/mailman/listinfo/oberon
More information about the Oberon
mailing list