Re: Low-Rent Syntax

Theo Norvell <norvell@csri.toronto.edu>
Sun, 12 Aug 90 13:52:41 GMT

          From comp.compilers

Related articles
Low-Rent Syntax Donald.Lindsay@MATHOM.GANDALF.CS.CMU.EDU (1990-08-09)
Re: Low-Rent Syntax norvell@csri.toronto.edu (Theo Norvell) (1990-08-12)
Re: Low-Rent Syntax doug@nixtdc.UUCP (1990-08-12)
Low-Rent Syntax steve@taumet.com (Stephen D. Clamage) (1990-08-12)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Theo Norvell <norvell@csri.toronto.edu>
In-Reply-To: <1990Aug09.180536.18782@esegue.segue.boston.ma.us>
Keywords: parse
Organization: CSRI, University of Toronto
References: <25630@cs.yale.edu> <58091@lanl.gov> <1990Jul26.024449.1777@esegue.segue.boston.ma.us> <1990Jul27.034115.8747@esegue.segue.boston.ma.us>
Date: Sun, 12 Aug 90 13:52:41 GMT

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
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.