Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!snorkelwacker!spdcc!ima!esegue!compilers-sender From: bart@videovax.tv.tek.com (Bart Massey) Newsgroups: comp.compilers Subject: Semicolons (Re: Low-Rent Syntax) Keywords: parse, design Message-ID: <1990Aug13.214001.16423@esegue.segue.boston.ma.us> Date: 13 Aug 90 21:40:01 GMT References: <1990Aug12.205529.11691@esegue.segue.boston.ma.us> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: Bart Massey Organization: Tektronix TV Measurement Systems, Beaverton OR Lines: 61 Approved: compilers@esegue.segue.boston.ma.us In article <1990Aug12.205529.11691@esegue.segue.boston.ma.us> Stephen D. Clamage writes: > There has been some discussion about *how* to design languages which do > not need semicolons to separate or end statements. No one has brought up > why you would want to. ... > Finally, beginning programmers are going to make all kinds of errors, for > all kinds of reasons. For more-experienced programmers, are semicolon > errors a real problem -- as big as other kinds of syntax errors? I'd say > no. Well, I'll admit it :-). I've been programming in C professionally for about 5 years, and about 1/2 my extra trips into the editor are still to correct missing semicolons. I almost never *add* semicolons, though. This is true of most C programmers I know. And note that when the added semicolon does appear, it usually takes the insidious form x = 100; while( x );/* a nasty case */ /* * these comments are intended only to obscure the fact * that the next statement will never be executed... */ x--; I claim that a moment's thought tells us why it is that semis are such a big problem in traditional languages -- we all have been taught a "structured" style which emphasizes regular use of whitespace, but traditional compiled languages are completely insensitive to the use of whitespace. > One example was given of > a = b > + c > as being a legal sequence of statements in one language. Almost certainly > this was meant to be a single statement. What made you think this? The exactly-one-assignment-statement-per-line convention, a very common idiom across many otherwise widely different languages (LISP and friends being the most obvious exception I can think of offhand). And yet your compiler or interpreter probably wouldn't even optionally whine about the above, much less refuse to generate code. If I ever design a C-like language (which is unlikely, since C is pretty good for this :-), it'll be spec'ed in such a way as to generate warnings if line breaks appear in funny places, or the indentation looks wrong. It's a bit harder to implement, but I'm just plain tired of debugging code (of my own and others' :-) like if( v ) w; if( x ) y; else /*XXX*/; z; Bart Massey ..tektronix!videovax.tv.tek.com!bart ..tektronix!reed.bitnet!bart [I never found rogue semicolons to be such a problem, but I suspect that my style uses a lot more braces than yours. -John] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {ima | spdcc | world}!esegue. Meta-mail to compilers-request@esegue.