Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!caip!topaz!gaynor From: gaynor@topaz.RUTGERS.EDU (Silver) Newsgroups: net.lang Subject: Re: compound statements Message-ID: <5303@topaz.RUTGERS.EDU> Date: Wed, 9-Jul-86 01:06:36 EDT Article-I.D.: topaz.5303 Posted: Wed Jul 9 01:06:36 1986 Date-Received: Wed, 9-Jul-86 06:46:46 EDT References: <5281@topaz.RUTGERS.EDU> <2296@umcp-cs.UUCP> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 55 [] In article <2296@umcp-cs.UUCP>, mangoe@umcp-cs.UUCP (Charley Wingate) writes: [clarification, not really there] > Silver {...!topaz!gaynor} writes: > > > [flamage about languages requiring the body of (sub-)programs be > > restricted to compound statements] [clarifaction, not really there] > > 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? == example.pseudo == # 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'. If you need to verify this to yourself (I did, of course, because I'm posting :-), write some sample test code and mentally parse it... _ /| \`o_O' ( ) Aachk! Phft! U Disclaimer: The opinions and/or information and/or code expressed here were generated by this characature, stolen from Dave Rasmussen, to which I have taken the liberty of adding ears. So don't look to me for a disclaimer! Silver {...!topaz!gaynor}