🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #6886

Re: Anyone want to design a language?

#6886
From: Peter da Silva
Date: Sun, 11 Mar 1990 02:19
55 lines
2004 bytes
In article <16136@haddock.ima.isc.com> karl@haddock.ima.isc.com (Karl Heuer) writes:
> You'd need to tweak the syntax to distinguish a two-exit loop from two
> adjacent loops, of course.

Yeh, I though of this:

	do
		statement
	while(expr)
		statement
	...

> (Note: If it's really a *new* language, rather than a suggestion for the next
> version of C, then you don't need to deprecate things--you simply remove them
> immediately.  There's no backward compatability problem.)

Good point. We'll use gotos instead.

> I must object.  The whole point of C's for-statement is to put all the loop
> control in one place, at the top of the statement.  This looks like a step
> backwards.

We can put it back later. Let me be a literal minded language purist for a
while. A good macro facility (like lisp's) that works within the syntax
of the language can be used to put it back...

macro "for(@?initial; @?test; @?final) @body"
{
	@if(?initial) @initial;
	while(@if(?test) @test @else true) {
		@body;
1:		@if(?final) @final;
	}
2:
}

macro "continue"
{
	goto forward(1);
}

macro "break"
{
	goto forward(2);
}

> And isn't that clause "while (true)" a no-op in this language?

It provides a target for "continue". But since we're using gotos instead,
let's leave that out.
-- 
 _--_|\  `-_-' Peter da Silva. +1 713 274 5180. <peter@ficc.uu.net>.
/      \  'U`
\_.--._/
      v
Technical Details
Message-ID: <SB52.P2ficc@ficc.uu.net>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!sugar!ficc!peter
References: <22569:05:10:24@stealth.acf.nyu.edu> <8475@wpi.wpi.edu> <24123:04:14:07@stealth.acf.nyu.edu> <1966@l.cc.purdue.edu> <191@gollum.twg.com> <78=1NPDxds13@ficc.uu.net> <16136@haddock.ima.isc.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!texbell!sugar!ficc!peter
From: peter@ficc.uu.net (Peter da Silva)
Newsgroups: comp.lang.misc
Subject: Re: Anyone want to design a language?
Message-ID: <SB52.P2ficc@ficc.uu.net>
Date: 11 Mar 90 02:19:28 GMT
References: <22569:05:10:24@stealth.acf.nyu.edu> <8475@wpi.wpi.edu> <24123:04:14:07@stealth.acf.nyu.edu> <1966@l.cc.purdue.edu> <191@gollum.twg.com> <78=1NPDxds13@ficc.uu.net> <16136@haddock.ima.isc.com>
Reply-To: peter@ficc.uu.net (Peter da Silva)
Organization: Xenix Support, FICC
Lines: 50