|Re: Turing syntax, was Low-Rent Syntax email@example.com (Theo Norvell) (1990-08-13)|
|From:||Theo Norvell <firstname.lastname@example.org>|
|Organization:||CSRI, University of Toronto|
|References:||<email@example.com> <firstname.lastname@example.org> <1990Jul26.email@example.com> <1990Jul27.firstname.lastname@example.org> <1990Aug09.email@example.com>|
|Date:||Mon, 13 Aug 90 01:59:04 GMT|
In article <1990Aug12.firstname.lastname@example.org> 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.
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
rather than the correct
for i : 1..10
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
Return to the
Search the comp.compilers archives again.