Re: Turing syntax, was Low-Rent Syntax

Theo Norvell <norvell@csri.toronto.edu>
Mon, 13 Aug 90 01:59:04 GMT

          From comp.compilers

Related articles
Re: Turing syntax, was Low-Rent Syntax norvell@csri.toronto.edu (Theo Norvell) (1990-08-13)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Theo Norvell <norvell@csri.toronto.edu>
In-Reply-To: <1990Aug12.135436.10405@esegue.segue.boston.ma.us>
Keywords: parse, design
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> <1990Aug09.180536.18782@esegue.segue.boston.ma.us>
Date: Mon, 13 Aug 90 01:59:04 GMT

In article <1990Aug12.135436.10405@esegue.segue.boston.ma.us> you write:


>[Any idea whether it's particularly easy or hard to diagnose syntax errors
>in Turing programs? -John]


Since the grammar is LL(1), _detection_ is theoretically as easy as in e.g.
Pascal.


But some errors do transform legal syntax to legal syntax where this would
not be the case if semicolons were mandatory. For example, if the comma is
accidentally omitted from the statement


put a(i), b(i)


it becomes two statements "put a(i)" and "b(i)" the latter being
(syntactically) a procedure call. Such a mistake would always cause a
context-constraint error (in this case, because "b" would not be a
procedure). A similar case is if you write


for i : 1..10 do
S
end for


rather than the correct


for i : 1..10
S
end for


The "do" is treated as a procedure call.


In most cases that come up in practice, though, syntax error detection,
diagnoses, and recovery are well done in the Turing compilers. One
effective (but heuristic) recovery strategy used is to skip everything up to
the end of the line.


After you have programmed in Turing for a while, you never again want to use
semicolons. The simplicity of the syntax reduces the number of syntax
errors by such a degree that it is easy to put up with the occasional
misdiagnoses.


Theo Norvell
--


Post a followup to this message

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