Semicolons (Re: Low-Rent Syntax)

Bart Massey <>
Mon, 13 Aug 90 21:40:01 GMT

          From comp.compilers

Related articles
Semicolons (Re: Low-Rent Syntax) (Bart Massey) (1990-08-13)
Re: Semicolons (Re: Low-Rent Syntax) codex!peterd@uunet.UU.NET (1990-08-20)
Semicolons (Re: Low-Rent Syntax) (1990-08-22)
Re: Semicolons (Re: Low-Rent Syntax) (1990-08-24)
Re: Semicolons (Re: Low-Rent Syntax) mjr@decuac.DEC.COM (1990-08-25)
Re: Semicolons (Re: Low-Rent Syntax) (Bart Massey) (1990-08-26)
Re: Semicolons (Re: Low-Rent Syntax) elsie!ado@uunet.UU.NET (1990-08-27)
[9 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: Bart Massey <>
Keywords: parse, design
Organization: Tektronix TV Measurement Systems, Beaverton OR
References: <>
Date: Mon, 13 Aug 90 21:40:01 GMT

In article <> 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...

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 )
if( x )
else /*XXX*/;
Bart Massey
[I never found rogue semicolons to be such a problem, but I suspect that
my style uses a lot more braces than yours. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.