Path: utzoo!attcan!uunet!mcvax!ukc!etive!dcl-cs!nott-cs!anw From: anw@nott-cs.UUCP Newsgroups: comp.lang.misc Subject: Re: Algol-style semicolons Message-ID: <600@tuck.nott-cs.UUCP> Date: 21 Dec 88 15:01:44 GMT References: <1126@etive.ed.ac.uk> <208100002@s.cs.uiuc.edu> <868@mcrware.UUCP> <4396@tekgvs.GVS.TEK.COM> Reply-To: anw@maths.nott.ac.uk (Dr A. N. Walker) Organization: Department of Mathematics, The University, NOTTINGHAM, NG7 2RD, UK. Lines: 37 In article <4396@tekgvs.GVS.TEK.COM> toma@tekgvs.GVS.TEK.COM (Tom Almy) writes: > >[...] "Why do we need semicolons at all?". [He writes a compiler that doesn't use semicolons at all ...] >I would contend that most, if not all, Algol-derived languages would work >just fine without semicolons! The only problem being the way some languages >define control structures require the existance of the semicolon as a null >statement. When I was running a "Compilation Techniques" course, a few years back, one of the assignments was to alter the Pascal syntax in various ways, Yacc the results, and comment. One of the ways was to throw away semicolons. In Pascal, as TomA asserts, the *only* problem is that it becomes difficult to see where the null statements are. If null statements are -- as they should be -- explicitly written, eg as "SKIP", even that problem goes away, and the semicolon becomes totally redundant. In C and Algol, semicolons are harder to dispose of. For example, consider the Algol: UNION (REAL, PROC (REAL) REAL) foo = cos #;# (pi) # is "foo" set to "cos" or to "-1.0"? # or PROC REAL bar: (x := pi #;# - 2) # return "-2" and assign "pi", or assign & return "pi-2"? # or STRING s := "Hello World!" #;# [7] #;# REAL x # "s" is "Hello World!" and "x" is an array, or "s" is "W" and "x" is a real variable? # C examples left to the reader! -- Andy Walker, Maths Dept., Nott'm Univ., UK. anw@maths.nott.ac.uk