[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Goal of closeparen error recovery



When there is an unbalanced paren in a file being compiled, the
compiler ought to do more than just print a precise and informative
error message.  It ought to be able to compile the rest of the file
properly, so that the user can get appropriate warnings about the rest
of the functions, so that he can fix more than one error per
compilation attempt.

In order to accomplish this, the compiler must be able to get back in
synch in its input stream, correctly figuring out where a new function
is actually beginning.  The syntax of s-expressions, itself, does not
supply any information that can be used to do this: a paren inside a
function looks like a paren at top level.  It requires some additional
syntactical information.  This could be, the column position of the
start of a list.  It could be anything else, ad lib, but indentation
has the advantage that it is already present in existing source files.
Any other syntactic marker would have to be inserted at every
top-level list, to tell the compiler which those were.  This change
would probably be unpleasant.

It would be easy to have a file property to turn off such indentation
checking for the sake of weirdly indented files, but since most people
follow indentation conventions anyway, they would probably just as
soon have the checking by default.