[Oberon] The Extended WHILE Statement
Chris Burrows
cfbsoftware at gmail.com
Wed May 20 01:45:51 CEST 2026
A new language feature introduced in Oberon-07, and implemented in the
Astrobe compilers is the Extended WHILE (aka the *Djikstra WHILE*)
statement. It is described in the document *Porting the Oberon Compiler
from Oberon to Oberon-07
<https://people.inf.ethz.ch/wirth/Oberon/PortingOberon.pdf>* by Niklaus
Wirth
and is shown as the last example in the *WHILE statement* syntax diagram
<https://astrobe.com/OberonSyntax/WhileStatement.htm>
This was an unfamiliar construct which I hadn't seen in other languages so
it was not immediately obvious to me where it could be of use.
I am curious to know if any of you have used it in an application. I'll
award a free Professional copy of the Astrobe compiler of your choice for
the best (IMHO) reply.
(Note to Paul R - you are excluded from applying) ;-)
To save you the bother of cheating, I asked AI to suggest some
applications. This is what she came up with:
*State Machine Controllers*: Managing complex workflows (e.g., in embedded
systems or parsers) that transition between different operating states
based on hardware or software flags, without needing nested IF statements.
*Interactive Command Interpreters*: Processing single-character commands or
menu inputs. The WHILE loop checks sequentially for different keys (e.g.,
'a', 'b', 'c') and naturally terminates when an invalid character exits the
menu.
*Multi-Condition Resource Polling*: Looping to check the status of multiple
hardware devices or network sockets. The structure evaluates each flag one
by one, executing the routine for the highest-priority active device.
*Lexical Scanners (Tokenization)*: Scanning characters in a string. Each
branch checks if the current character matches a specific token category
(e.g., a digit, an operator, or a letter), processing them as appropriate.
*Game Turn or Event loops:* Sequentially processing queued inputs, AI state
updates, or animation frames in prioritized succession, falling out of the
loop only when the event queue is entirely empty.
--
Regards,
Chris Burrows
CFB Software
https://www.astrobe.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.inf.ethz.ch/pipermail/oberon/attachments/20260520/dbea01d9/attachment.html>
More information about the Oberon
mailing list