ark@alice.UUCP (02/29/88)
The best scheme I've seen for labelled blocks comes from SETL. In SETL, statements like `IF' and `WHILE' begin blocks which must be ended by `END' statements. Thus one can write: IF x > y THEN max := x; ELSE max := y; END; (I think I have the semicolons right; I'm sure about the one after END) When these structures are nested deeply, one may be confused about just what is being ended. To reduce confusion, the programmer may insert any number of tokens from the opening statement between the END and the semicolon: IF x > y THEN max := x; ELSE max := y; END IF x > y; These tokens are optional, but if they appear, they must match the corresponding tokens from the opening statement.
rcvie@tuvie (ELIN Forsch.z.) (03/07/88)
In article <7718@alice.UUCP> ark@alice.UUCP writes: >The best scheme I've seen for labelled blocks comes from SETL. >In SETL, statements like `IF' and `WHILE' begin blocks which >must be ended by `END' statements. Thus one can write: > > IF x > y > THEN max := x; > ELSE max := y; > END; > >(I think I have the semicolons right; I'm sure about the one after END) > >When these structures are nested deeply, one may be confused about >just what is being ended. To reduce confusion, the programmer may >insert any number of tokens from the opening statement between the >END and the semicolon: > > IF x > y > THEN max := x; > ELSE max := y; > END IF x > y; > >These tokens are optional, but if they appear, they must match >the corresponding tokens from the opening statement. CHILL (CCITT High Level Language, a realtime application language)has a similar but less confusing syntax: IF x > y max := x; ELSE max := y; FI; There is also somethimg similar to the repetition of the opening statement at the end: Label: BEGIN blah blah END Label; This syntax helps the programmer to find better structures, but unfortunately the compilers cannot use the redundancy for a better recovery. The only advantage are sometimes improved error messages. Besides, studying this language will show anybody who is interested, how a language may be designed in a most horrible way from the compiler writer's point of view (many many keywords, indeterminisms, semantics nobody understands totally, etc.). Dietmar Weickert, ALCATEL-ELIN Research Center, Vienna, Austria.