Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!decvax!mcvax!steven From: steven@mcvax.UUCP (Steven Pemberton) Newsgroups: net.lang.c Subject: Re: `if` `(` expr `)` stmt vs `if` expr `then` stmt ..... Message-ID: <5817@mcvax.UUCP> Date: Thu, 24-May-84 10:00:37 EDT Article-I.D.: mcvax.5817 Posted: Thu May 24 10:00:37 1984 Date-Received: Sat, 26-May-84 02:18:51 EDT References: <1123@qubix.UUCP> Organization: CWI, Amsterdam Lines: 39 > Anyone who is a serious student of programming linguistics, > should realize that a delimiter is necessary to separate the > expression from the statement in all conditional language-constucts > -- if you want to keep your grammer LALR(1) (almost a given). Nonsense. You can even define an LL1 grammar with no delimiter. > I prefer the '(' ')' of C, to the 'if' 'then' of Pascal, because: > [1] It is shorter to type, [2] Is symmetrical, and > [3] Does not disguise the true purpose of the construct. Isn't also symmetrical? How is the true purpose of the construct disguised by the absence of brackets, and the presence of 'then'? > NON-symmetry is the most aggravating part of programming Pascal, > as anyone who has been bitten by the: > > can tell you. Semicolons are separators in Pascal and not terminators, just as commas are in C. Your mistake is thinking that the semicolon has anything to do with the statement. It doesn't; the correct view is You wouldn't expect to see a function call like f(a,b,c,); semicolons play the same role as commas in Algol-like languages. I expect that having trouble with Pascal semicolons is a product of one's previous experience. My first languages were Fortran followed by Algol 68, and I've never experienced the separator vs. terminator problem. However, I expect that if my first language had been C, I would have had. When I first learnt C, I kept missing semicolons out, such as if (a>b) {a=0; b=0} But that was my fault, not the language's. Actually, semicolons are completely unnecessary. You can define a language without statement terminators or separators, and also without things like Fortran's continuation lines. See for instance "Keyword Grammars" by Geurts and Meertens, in Proc. 5th Annual III conference, 1977, published by INRIA, Le Chesnay, France. Steven Pemberton, CWI, Amsterdam. steven@mcvax