🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #5399

Re: Loops

#5399
From: Rahul Dhesi
Date: Tue, 29 Mar 1988 17:07
29 lines
1298 bytes
In article <294@tmsoft.UUCP> mason@tmsoft.UUCP (Dave Mason) writes:
>In a language I designed for my students to implement in my compiler
>course loops look like:
>	do
>	   ...
>	   while expr
>	   ...
>	od
>where the while can go anywhere & there can be any number of them...

Unfortunately, somebody modifying code with such a construct will
seldom be sure that he has tracked down all the exit points.  The same
problem exists with goto, exit, break, etc.

A possible solution:

     do (2 exits)
	...
	while expr
	...
	while expr
	...
     done

The assertion "(2 exits)" tells the compiler to flag a syntax error if
the number of loop exits is not exactly 2.  The default, in the absence
of this assertion, could be exactly one exit.  Also "(no exits)".
-- 
Rahul Dhesi         UUCP:  <backbones>!{iuvax,pur-ee,uunet}!bsu-cs!dhesi
Technical Details
Message-ID: <2488@bsu-cs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!ihnp4!inuxc!iuvax!bsu-cs!dhesi
References: <2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <294@tmsoft.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!clyde!att-cb!att-ih!ihnp4!inuxc!iuvax!bsu-cs!dhesi
From: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Newsgroups: comp.lang.misc
Subject: Re: Loops
Message-ID: <2488@bsu-cs.UUCP>
Date: 29 Mar 88 17:07:01 GMT
References: <2827@enea.se> <1557@pasteur.Berkeley.Edu> <2773@mmintl.UUCP> <294@tmsoft.UUCP>
Reply-To: dhesi@bsu-cs.UUCP (Rahul Dhesi)
Organization: CS Dept, Ball St U, Muncie, Indiana
Lines: 29