Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!sri-spam!sri-unix!hplabs!sdcrdcf!burdvax!psuvax1!psuvm.bitnet!dmb From: DMB@PSUVMA.BITNET Newsgroups: net.lang Subject: Discussion on removing punctuation in programming languages Message-ID: <7796DMB@PSUVMA> Date: Wed, 8-Oct-86 15:55:07 EDT Article-I.D.: PSUVMA.7796DMB Posted: Wed Oct 8 15:55:07 1986 Date-Received: Fri, 10-Oct-86 00:43:50 EDT Expires: Mon, 17-Nov-86 00:00:00 EDT Lines: 105 Punctuation or seperators (; , .) have long been a part of programming language design. Anyone who has programmed for even the shortest amount of will realize that these little demons are responsible for a large amount of possible errors, thus the question is why have them at all? The obvious answer is not for the programmer, but for the compiler writer and his compiler. This is true for at least two reasons. One, the seperator (usually a parse list seperator (, or ;) signals the the parser that another item is following which should be included in the list (i.e. repeat while next symbol is a seperator) instead of having to repeat until you reach an end of list symbol. Second, error recovery is easily done for instance in Pascal's ; because on an error, the parser can go into panic mode until it sees a ; at which time it can assume that things are pretty stable and continue parsing again. The question is, are these or any other reasons valid enough to keep these gremlins in the programming language specifications. Maybe so, i assume not. What is it that we really want by using seperators 1) When a parse unit begins and ends 2) ??????? By a parse unit i mean such things as statements, blocks, declarations,etc. How do we know when a unit ends and the next begins? Until now we used the seperator. I consider Wirth's Modula-2 an attempt to take a step away from all this seperator nonsense. However, he choose not to do so, as the semicolon is still prevalently used. I propose we can remove the semicolon, without losing its effectiveness by insisting that statements (and in general parse units) be equally bracketed. By this I mean that every construct have some sort of end-construct at the end of the construct. In Modula-2, for instance, the for statement is for id := expr to expr END. And similarly if's, case's repeats,whiles all have end "brackets". Thus any two of these compounds when butted up against each other, the beginning and end of each statement can be found even if one of the middle symbols is missing. (missing symbols meaning, the ending symbol of the first compound statement or the beginning symbol of the second compound statement). This is exactly what the semicolon was used for. Ah but there is a problem, the assignment statement! consider the statements a := b + c e := f + g Without a seperator, you don't know if the e is part of the first statement (missing operator) or part of the second statement, UNTIL you read the second :=. Thus I will require an end of assignment statement token to be introduced, (notice a weakness in my proposal here). But the assignment statement is the only case where this is needed. Is this arguement clear? Correct? Example program with proposed syntax. Program Dummy Const (v p x) = 5 Type thetype = array[0 5] of integer Var (x1 x2 x3 x4 x5):integer (y1 y2 y3 y4 y5):real Procedure proc1(var (x3 x2):integer) begin x1 := x3 + x2 END for x1 := 1 to x5 do x4 := 1 div x1 END while x4 < 10 do x4 := 1 + x4 end end end begin x3 = 0 repeat proc1(x3,x5) until x3 > x5 end end Don't try to analyse this program, it does nothing at best. Admittedly, this looks an awful lot like swapping ; for end, and that is probably so. But aren't end's alot more intuitive then ; ? Maybe not, maybe so. Which is better? That's up to you.. What do you think? As a side note does any language allow the mathematically normal syntax of IF (4 < x < 8) THEN blabla I don't think so, but why not? dave brosius dmb at psuvma.bitnet