Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!lll-crg!seismo!umcp-cs!mangoe From: mangoe@umcp-cs.UUCP (Charley Wingate) Newsgroups: net.lang Subject: Re: compound statements Message-ID: <2322@umcp-cs.UUCP> Date: Thu, 10-Jul-86 01:04:53 EDT Article-I.D.: umcp-cs.2322 Posted: Thu Jul 10 01:04:53 1986 Date-Received: Fri, 11-Jul-86 06:36:42 EDT References: <5303@topaz.RUTGERS.EDU> Organization: University of Maryland, Dept. of Computer Sci. Lines: 51 Silver writes: >> In languages like Pascal, where there may be functions within >> functions, it is necessary to have some sort of "end-of-procedure" >> delimiter. >Not true. >What gives rise to ambiguity is the null statement. Consider a >language that allows null statements, and an arbitrary statement as a >(sub-)program body. In the following, example, to which procedure >would the 'writestring' be bound? ># I consider the 'program' keyword to be unnecessary. # >procedure example (output - text) > > procedure this > > procedure that > ># the code in question # >writestring (output, "What procedure calls this statement?") >==================== >Recall how Pascal resolves 'else' clause ambiguities. Simply bind it >to the nearest unclosed 'if-then' (not 'if-then-else') statement. >That convention is applicable here. If the definition of the language >stated that a statement is bound to the nearest unclosed procedure, >then no ambiguity results. The 'writestring' statement is bound to >'that', a null-statement to 'this' and 'test'. Well, ACCCKK PTHT. What if you have TWO statements? Which belongs to whom? Program X(output); Procedure Y; { Begin } Writeln("A"); { End; } { Begin } Writeln ("b"); Y; { End. } Now, with all the begin-end constructs eliminated, how do you tell which statements belong to which procedure? (Obviously, the "begins" are all superfluous. The "ends" aren't, though.) C. Wingate