Re: error reporting, was Language used to write compilers

Chris F Clark <>
31 Dec 2004 13:05:34 -0500

          From comp.compilers

Related articles
Language used to write compilers (Joe H.) (2004-12-29)
Re: Language used to write compilers (2004-12-30)
Re: error reporting, was Language used to write compilers (Chris F Clark) (2004-12-31)
Re: error reporting, was Language used to write compilers (Louis Krupp) (2005-01-09)
Re: error reporting, was Language used to write compilers (Chris F Clark) (2005-01-14)
| List of all articles for this month |

From: Chris F Clark <>
Newsgroups: comp.compilers
Date: 31 Dec 2004 13:05:34 -0500
Organization: The World Public Access UNIX, Brookline, MA
References: 04-12-148 04-12-158
Keywords: errors
Posted-Date: 31 Dec 2004 13:05:34 EST

Nick Maclaren wrote:
> Slightly off-topic, but indicative, is the fact that almost no
> compilers identify the line for both ends of a bracketting mismatch.
> Why not? It is TRIVIAL to do in 95% of cases. But, for at least 50
> years, it has been a blind spot for compiler writers. And yet it
> is well-known to be a continual, low-level sink of effort for people
> working on large codes.

I think this is a fairly valid gripe. I think part of the reason is
that most compilers have "too simple" of an error reporting mechanism.
The error reporting mechanism allows the report of an error as text
associated with one spot in the program. If one wants to report a
mismatch between two spots, one must output two error messages. I've
been facing this problem with the Verilog compiler I work on for my
day job. There are lots of times when the compiler gets in the
situation where a new fact disagrees with some existing knowledge
base. The simplest solution is to just print out that the new
information causes an error, and our compiler takes that cop-out far
too many times. The better solution is to track where the previous
knowledge was determined and print a message (even if it takes two
error messages to do do) showing both the site of the new information
and the old information. However, it often takes a fair amount of
work to track the appropriate old information, and it isn't the kind
of thing that adds "significant new functionality" like management

In any case, I am thinking about putting some features in Yacc++
(actually in the Language Objects Library) to simplify the reporting
errors that have "more than one relevant location". I know if it was
easier I would do it more often. More importantly, if I saw that it
was easy to do in one way, it would motivate me to find uses of the
feature. I doubt that I'm unique in that aspect.

Thanks for the motivation,

Chris Clark Internet :
Compiler Resources, Inc. Web Site :
23 Bailey Rd voice : (508) 435-5016
Berlin, MA 01503 USA fax : (978) 838-0263 (24 hours)

Post a followup to this message

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