moss@cs.umass.edu (Eliot Moss) (07/27/90)
In the design of CLU we orginally had Algol/Pascal style control construct syntax, such as "if <expr> then <stmt> else <stmt>" (i.e., without closing keyword), so that one required a begin/end pair for a then or else action more than one statement long. Even with single character abbreviations for begin/end (we used "{" and "}") we felt this was a pain, and while a closing bracket does mean a little more typing, it is leads to simpler program modification, especially adding/deleting statements. Having a closing bracket also resolves the syntactic ambiguity of the "dangling else" in "if .. then .. if .. then .. else" (i.e., does the else go with the first or second then?). I have also heard (but do not know a definitive reference; i.e., this is a rumor) that Wirth said he made a mistake in the Pascal syntax, and fixed it in Modula-2. Sure enough, Modula-2 and its descendants have closing bracket control constructs. It is another matter whether one prefers "if .. fi", "if .. end", "if .. end if", or "if .. endif", and I doubt we'll ever reach consensus on that. Related to BEGIN/END blocks is the argument over whether the ";" that follows some statements should be a separator or a terminator, the difference being whether it can occur after the last statement in a list. Similar issues arise with separator tokens in some forms of case statements (see the Modula-3 syntax for examples). It is possible to allow *both* styles with careful syntax design; Modula-3 (for one) does that. I tend to favor the more uniform "terminator" style since, again, it makes additions and deletions simpler. CLU was actually able to *eliminate* the ";" statement separator/terminator, through *very* careful syntax design (and maybe it required more than one token lookahead, too; I don't recall clearly). Anyway, that should be enough grist for another long running and potentially boring usenet interchange .... -- J. Eliot B. Moss, Assistant Professor Department of Computer and Information Science Lederle Graduate Research Center University of Massachusetts Amherst, MA 01003 (413) 545-4206; Moss@cs.umass.edu -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus| world}!esegue. Meta-mail to compilers-request@esegue.