Path: utzoo!attcan!uunet!husc6!spdcc!ima!compilers-sender From: uokmax!glcowin@Central.Sun.COM (Greg Cowin) Newsgroups: comp.compilers Subject: Re: Why can't we build a C compiler? Message-ID: <3210@ima.ima.isc.com> Date: 18 Jan 89 19:44:39 GMT Sender: compilers-sender@ima.ima.isc.com Reply-To: uokmax!glcowin@Central.Sun.COM (Greg Cowin) Lines: 65 Approved: compilers@ima.UUCP Dale Worley writes the following: > I think that part of the problem is the C is not all that well > defined. And later writes the following: > Another rule for decent language design: > If the grammar that you want to present to the user in the reference > manual isn't LALR(1), the language design should be considered > deficient. > Following rules like this in language design should get rid of much of > the work of compiler writing, since they eliminate features of the > language that make compiler writing hard, but don't add anything > useful for the user. PROBLEM ------- Overlooking the real problem of defining a programming language seems to be very common. The problem is providing a formal semantic definition. This problem is not easily solved, although it can be done. GRAMMARS -------- I do not think that limiting ourselves to LALR(1) grammars is going to solve the problem. Also, why limit ourselves to only to LALR(1) grammars. In fact, to some degree the grammar is insignificant. Formalization of syntax is a simpler problem than the formalization of semantics. C - Is C a (somewhat) portable language, because of the formalization of semantics? If it were, we would not be having these querky problems. Could it be portable, because of porting the UN*X operating to many different architectures? Yes, isn't the UN*X operating system a big test suite. Even though it is big, it is still inadequate. Note: I believe the preprocessor has also helped portability; therefore, the portability is somewhat inherent. SOLUTION -------- The solution is not an easy one. Presently, we usually describe semantics informally and formal specification of semantics can be complex and arcane. Although I do not have a solution, it is an area that we should give more attention. I certainly plan to give it more attention. After all, it is interesting and a major part of the process that we enjoy. SOMETHING TO THINK ABOUT ------------------------ Are C compilers lacking? Or is it the formal specifications of the C programming language? Are not our compilers dependent on the language specification? ----------------------------------------------------------------------- Greg Cowin occrsh!uokmax!glcowin or University of Oklahoma occrsh!uokmax!gpsun!glc -- Send compilers articles to ima!compilers or, in a pinch, to Levine@YALE.EDU Plausible paths are { decvax | harvard | yale | bbn}!ima Please send responses to the originator of the message -- I cannot forward mail accidentally sent back to compilers. Meta-mail to ima!compilers-request