Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!cs.utexas.edu!yale!mintaka!snorkelwacker!spdcc!esegue!compilers-sender From: doug@nixtdc.UUCP (Doug Moen) Newsgroups: comp.compilers Subject: Re: Low-Rent Syntax Keywords: parse,design Message-ID: <1990Aug12.135436.10405@esegue.segue.boston.ma.us> Date: 12 Aug 90 13:54:36 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> <1990Aug09.180536.18782@esegue.segue.boston.ma.us> Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: doug@nixtdc.UUCP (Doug Moen) Organization: Nixdorf Computer Engineering Company Lines: 36 Approved: compilers@esegue.segue.boston.ma.us Donald.Lindsay@MATHOM.GANDALF.CS.CMU.EDU: >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] -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus| world}!esegue. Meta-mail to compilers-request@esegue.