Article View: gnu.gcc.help
Article #42528Re: Q: layout based parsing
From: William S. Gribble
Date: Fri, 01 Dec 1995 00:00
Date: Fri, 01 Dec 1995 00:00
28 lines
1928 bytes
1928 bytes
faase@cs.utwente.nl (Frans F.J. Faase) writes:
> Could it be possible to improve gcc by including layout
> information. Possibly this should be activated by a switch
> indicating the style that is being used.
> (I think it can be done by some simple bookkeeping, remembering
> at which position the last '{' and '(' appeared, and correcting
> this with information about the position of the `if', `do', `while'
> and `for' keywords. This information can be used to determine what
> should be done in case of a syntax error.)
Let's assume for the moment that gcc can gather and keep this kind of
information, and furthermore that it can exactly analyze the
programmer's intent from the layout and determine what you Actually
Meant To Do. Now, what do you want the compiler to do when it notices
that there's a syntax error? It can either (1.) silently ``correct''
your mistake using its guess about what you meant, resulting in a
possibly incorrect program and a definitely non-portable one,
or (2.) print a message like ``syntax error'', only with some nifty
diagnostics telling you exactly what you might have done wrong and
then exit.
IMHO it's an understatement to say that it would be a waste of time to
add this kind of functionality to the compiler. How much of your
debugging time is spent fixing syntax errors? Not much, I'll bet.
What I want is a compiler that tells me when I've implemented the
algorithm incorrectly :)
Bill Gribble
Technical Details
Message-ID:
<GRIB.95Dec1085448@cascade.cs.utexas.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<49mj79$8lr@utrhcs.cs.utwente.nl>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,fd99fb045feb74a2 X-Google-Attributes: gid11318c,public From: grib@cs.utexas.edu (William S. Gribble) Subject: Re: Q: layout based parsing Date: 1995/12/01 Message-ID: <GRIB.95Dec1085448@cascade.cs.utexas.edu> X-Deja-AN: 120615979 distribution: world references: <49mj79$8lr@utrhcs.cs.utwente.nl> organization: Univ. of Texas at Austin, CS Dept. newsgroups: gnu.gcc.help