norvell@csri.toronto.edu (Theo Norvell) (08/13/90)
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 -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus| world}!esegue. Meta-mail to compilers-request@esegue.