Implementation decision

Michael Risse <>
22 Sep 1998 14:34:24 -0400

          From comp.compilers

Related articles
Implementation decision (Michael Risse) (1998-09-22)
Re: Implementation decision (1998-09-22)
Re: Implementation decision (Quinn Tyler Jackson) (1998-09-26)
Re: Implementation decision (Michael McKernan) (1998-09-26)
| List of all articles for this month |

From: Michael Risse <>
Newsgroups: comp.compilers
Date: 22 Sep 1998 14:34:24 -0400
Keywords: design, question, comment

Hello !

I am thinking about a question concerning the implementation of
programming languages.

I will describe my problem using the language C as an example.

In declarations we have typespecifiers such as 'void', 'float',
'int', 'unsigned' etc. The programmer is not allowed to use these
things in any desired combination. There are some constraints.
My question is: How to implement these constraints ?

We can build some (or all?) of the constraints in the grammar.
This would result in a much bigger grammar.

Another way is for example writing down this analysis in the
attributed grammar ?

I think, that beside of this specific example, there are many
similar problems.
Has the compiler writer the freedom to decide how to implement
such constraints or is there a guide line that helps me to find
the best solution ?
Thanks for your attention,
                 Michael Risse
[I'd do it semantically, either in the code that combines attributes or
ad-hoc. That lets you produce much better error messages, e.g., "invalid
addition of void and float" rather than "syntax error". -John]

Post a followup to this message

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