Re: error reporting, was Language used to write compilers

Louis Krupp <>
9 Jan 2005 20:52:32 -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: Louis Krupp <>
Newsgroups: comp.compilers
Date: 9 Jan 2005 20:52:32 -0500
Organization: Posted via Supernews,
References: 04-12-148 04-12-158 04-12-179
Keywords: errors
Posted-Date: 09 Jan 2005 20:52:32 EST

Chris F Clark wrote:
> 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
> likes.
> 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,

gcc does something like that. Given this file (pt.c):

static void f(void);

static void f(int x)

It prints this:

pt.c:4: conflicting types for `f'
pt.c:1: previous declaration of `f'

Louis Krupp

Post a followup to this message

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