Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!yale!mintaka!snorkelwacker!spdcc!ima!esegue!compilers-sender From: norvell@csri.toronto.edu (Theo Norvell) Newsgroups: comp.compilers Subject: Re: Low-Rent Syntax Keywords: parse Message-ID: <1990Aug12.135241.10330@esegue.segue.boston.ma.us> Date: 12 Aug 90 13:52:41 GMT References: <25630@cs.yale.edu> <58091@lanl.gov> <1990Jul26.024449.1777@esegue.segue.boston.ma.us> <1990Jul27.034115.8747@esegue.segue.boston.ma.us> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: Theo Norvell Organization: CSRI, University of Toronto Lines: 56 Approved: compilers@esegue.segue.boston.ma.us In-Reply-To: <1990Aug09.180536.18782@esegue.segue.boston.ma.us> In article <1990Aug09.180536.18782@esegue.segue.boston.ma.us> Donald Lindsay writes: >In article <1990Jul27.034115.8747@esegue.segue.boston.ma.us> > moss@cs.umass.edu (Eliot Moss) writes: >>CLU was actually able to *eliminate* the ";" statement separator/terminator, >>through *very* careful syntax design (and maybe it required more than one >>token look-ahead, too; I don't recall clearly). > >The Icon language (Arizona) and the Turing language (Toronto) both >have "low rent" syntax - that is, the ";" is only needed (as a >separator) when one writes multiple statements on a single line. In >all other cases, it can be omitted. > >Is there now a "usual" way to implement this ? In Turing, the semicolon is never needed. The reason is careful syntax design. There is no trickery in the lexical analysis and the grammar is LL(1). Consider the following LL(1) grammar SS --> | S SS S --> var name : T | procedure name A SS end name | function name A : T SS end name | E := E | if E then SS [else SS] end if | case E of {label E: SS} [label : SS] end case | loop SS end loop | for name : T SS end for | exit [when E] E --> etc T --> etc A --> etc No semicolons. In Turing the second clause is really SS --> S [ ; ] SS So you can sprinkle semicolons to taste. Euclid had a similar syntax, but a semicolon was still required in one obscure case. In Icon, the newline takes the place of the semicolon when a semicolon is syntactically allowed. This means you have to write a := b + c rather than a := b + c if you mean a := b + c The second is syntactically correct, but means something else. Griswold has a book on the implementation of Icon. Perhaps it explains the implementation of this rule. I haven't a clue about CLU. Theo Norvell U of T -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus| world}!esegue. Meta-mail to compilers-request@esegue.