Related articles |
---|
Error reporting/recovery bourguet@my-deja.com (Jean-Marc Bourguet) (2000-04-05) |
Re: Error reporting/recovery iank@bearcave.com (2000-04-11) |
Re: Error reporting/recovery grosch@cocolab.de (2000-04-11) |
Re: Error reporting/recovery bourguet@my-deja.com (Jean-Marc Bourguet) (2000-04-14) |
Re: Error reporting/recovery bourguet@my-deja.com (Jean-Marc Bourguet) (2000-04-14) |
Re: Error reporting/recovery rod.bates@wichita.boeing.com (Rodney M. Bates) (2000-04-14) |
Re: Error reporting/recovery nr@labrador.eecs.harvard.edu (2000-04-16) |
Re: Error reporting/recovery j.coulmance@itecor-software.com (Jocelyn Coulmance) (2000-04-20) |
Re: Error reporting/recovery pnyq@my-deja.com (2000-05-08) |
From: | "Rodney M. Bates" <rod.bates@wichita.boeing.com> |
Newsgroups: | comp.compilers |
Date: | 14 Apr 2000 23:51:30 -0400 |
Organization: | The Boeing Company |
References: | 00-04-053 00-04-074 00-04-090 |
Keywords: | errors |
Jean-Marc Bourguet wrote:
> I wonder how you can insert tokens for which the lexeme have an
> importance (say an identifier) without these phase having to take care
> about the fact that a token has been inserted and without generating
> spurious messages (like "identifier not defined").
I developed the habit of giving most of the fields in my data
structure a reserved value which means it is unknown or meaningless
because of earlier errors (, or possibly for some other reason).
Then every error check looks for such values in any of the data it
uses and does not generate error messages if there are any unknown
values.
You can usually find a value of a (compile-time) data type to use for
this purpose. I always give it a constant name with "Null", "Unknown",
or "Meaningless" in the identifier so I can change the value, if it
turns out be a needed "real" value I didn't originally think
of. Occasionally, it is necessary or easier to use a separate boolean
or put the reserved value into a related enumeration which also
denotes other things about the primary value.
I started this years ago on a program which was nothing like a
compiler, but it did enforce many validity rules on its input, many of
which depended on the results of earlier steps which could also have
generated error messages. Works great.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.