[fpc-pascal] Legitimate use of for and break

Bernd Oppolzer bernd.oppolzer at t-online.de
Sun Jun 18 08:53:47 CEST 2023

Am 18.06.2023 um 03:04 schrieb Hairy Pixels via fpc-pascal:
>> On Jun 18, 2023, at 1:07 AM, tsiegel at softcon.com wrote:
>> This is interesting, because it's the first time I've ever seen "break" as a valid command in pascal, and I've been using pascal since the mid/late 80s.  All kinds of dialects too, and I've never seen break as a keyword.  C, Python, Perl, sure, even shell scripts, but pascal? Never seen it used before.  Is this a relatively new addition to fpc or something?
> I don't remember break NOT being in Pascal. How did you exit a loop otherwise, goto? Break is common in basically all languages now. Can't think of a language I've used without it.
FWIW, when I started to work on New Stanford Pascal 
in 2011, the very first thing that I did was to add BREAK, CONTINUE and 
RETURN to this compiler.
New Stanford Pascal is an offspring of the Zürich P4 compiler from the 
1970s, directly from
the working group of Niklaus Wirth (who was at Stanford, too, BTW).

The compiler is a self-hosting compiler (like most Pascal compilers, I 
believe) and up to 2011
there were many exits from loops bye putting a label after the loop and 
using GOTO
(because of the absence of BREAK). Similar use of GOTO to implement 

I got rid of most of these labels (if not all) by adding these three 
keywords. This was easy.
I did many extensions to the compiler later (from 2016 on) and ported 
the compiler to Windows and
Linux etc.; the compiler, which had 6.000 lines in 2011, now has over 
25.000 lines :-)

Kind regards


> Regards,
> 	Ryan Joseph

More information about the fpc-pascal mailing list