Re: Low-Rent Syntax

doug@nixtdc.UUCP (Doug Moen)
Sun, 12 Aug 90 13:54:36 GMT

          From comp.compilers

Related articles
Low-Rent Syntax Donald.Lindsay@MATHOM.GANDALF.CS.CMU.EDU (1990-08-09)
Re: Low-Rent Syntax (Theo Norvell) (1990-08-12)
Re: Low-Rent Syntax doug@nixtdc.UUCP (1990-08-12)
Low-Rent Syntax (Stephen D. Clamage) (1990-08-12)
| List of all articles for this month |

Newsgroups: comp.compilers
From: doug@nixtdc.UUCP (Doug Moen)
Keywords: parse,design
Organization: Nixdorf Computer Engineering Company
References: <> <> <> <> <>
Date: Sun, 12 Aug 90 13:54:36 GMT

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

Actually, Icon and Turing are quite different in this respect.

In Icon, ";" is required as a separator in order to write multiple
statements on a single line. If you need to split a single statement over
several lines, you must be careful about where you put the line break: the
part of the statement which preceeds the newline must not look like a
valid statement.

Turing, on the other hand, doesn't rely on such kludges. Turing does not
use ";" as a statement separator or terminator, and it treats newline as
ordinary white space. Instead, the grammar is designed so that you can
always unambigously tell when one statement stops and another begins.

Some examples:
  - an if statement always begins with "if", and ends with "end if".
  - a procedure call statement begins with an identifier,
      and ends with a ) or an identifier.
  - an assignment statement begins with an identifier,
      and ends with an identifier, a literal constant, or ).
Note that in Turing, you can't write an arbitrary expression as a statement,
as you can in Icon or C. If you could, then the grammar would
be highly ambiguous. For example, you would not be able to
tell if "a - b" were one statement (ie, a-b;) or two (ie, a; -b;).
[Any idea whether it's particularly easy or hard to diagnose syntax errors
in Turing programs? -John]

Post a followup to this message

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