Re: error reporting, was Language used to write compilers

Louis Krupp <lkrupp@pssw.NOSPAM.com.INVALID>
9 Jan 2005 20:52:32 -0500

          From comp.compilers

Related articles
Language used to write compilers joe_hesse@actcx.com (Joe H.) (2004-12-29)
Re: Language used to write compilers nmm1@cus.cam.ac.uk (2004-12-30)
Re: error reporting, was Language used to write compilers cfc@shell01.TheWorld.com (Chris F Clark) (2004-12-31)
Re: error reporting, was Language used to write compilers lkrupp@pssw.NOSPAM.com.INVALID (Louis Krupp) (2005-01-09)
Re: error reporting, was Language used to write compilers cfc@shell01.TheWorld.com (Chris F Clark) (2005-01-14)
| List of all articles for this month |
From: Louis Krupp <lkrupp@pssw.NOSPAM.com.INVALID>
Newsgroups: comp.compilers
Date: 9 Jan 2005 20:52:32 -0500
Organization: Posted via Supernews, http://www.supernews.com
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:
<snip>
> 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.