Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 exptools; site whuxl.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!mike From: mike@whuxl.UUCP (BALDWIN) Newsgroups: net.lang.c Subject: Re: semicolons? Message-ID: <782@whuxl.UUCP> Date: Wed, 6-Nov-85 19:42:15 EST Article-I.D.: whuxl.782 Posted: Wed Nov 6 19:42:15 1985 Date-Received: Thu, 7-Nov-85 06:40:52 EST References: <335@graffiti.UUCP> <895@rlvd.UUCP> <742@mmintl.UUCP> <6107@utzoo.UUCP> <142@ucbjade.BERKELEY.EDU> Organization: AT&T Bell Laboratories, Whippany Lines: 39 > Let them separate two staments on the same line. Let line breaks > terminate statements if it makes sense to do so. I agree! Awk almost does this; its rules are: semicolons and newlines terminate statements, and a \ followed by newline is ignored. The shell acts like that too, and it will read more lines if it can't complete a statement. Seems to work just fine. > For example, a block could look like: > > { > x = 23; y = 40 > z = x + y > printf("Messy Format", x, y, z, > f) /* Statement didn't end, as it wouldn't parse */ > f = x + 7 /* Does this end? */ > * y /* Uh, no... */ But "f = x + 7" would be considered a complete statement. To end up with a reasonable parser, you have to decide as *soon* as you see the newline whether you have a stmt or not. If you want to continue it, put the * on the end of the line or put a \ there. If you don't enforce this, things like the following are ambiguous: f = x + 7 *y++ > Note: I haven't considered all the problems implicit in doing this in C. I'd > rather work on modern languages. But this started as a "wish list." True. Fat chance in h*ll C will change to do this, and it shouldn't. But it does make the terminator vs. separator argument look silly. PS: If you're *going* to use ; as terminator or separator, I would much rather it be a terminator, for the sole reason that adding/deleting else clauses doesn't require mucking up the then clause! -- Michael Baldwin {at&t}!whuxl!mike