Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!husc6!spdcc!ima!compilers-sender From: limonce@pilot.njin.net (Tom Limoncelli) Newsgroups: comp.compilers Subject: Re: Why can't we build a C compiler? Message-ID: <3213@ima.ima.isc.com> Date: 24 Jan 89 00:27:19 GMT References: <3210@ima.ima.isc.com> Sender: compilers-sender@ima.ima.isc.com Reply-To: limonce@pilot.njin.net (Tom Limoncelli) Organization: NJ InterCampus Network, New Brunswick, N.J. Lines: 49 Approved: compilers@ima.UUCP In article <3210@ima.ima.isc.com> uokmax!glcowin@Central.Sun.COM (Greg Cowin) writes: > 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. One of the major break-throughs of Algol/Pascal/C-like languages is that their syntax was completely specified in BNF (Backus-Naur Form?) or a BNF-like syntax notation. This allowed definitive specifications and since it was machine readable it was possible to make code-generators for languages that could be specified in BNF (or BNF-like) notation. Specifying *semantics* can be done without English (or a natural language). I can't remember the author but there's a book called "The Denotational Description of Programming Languages" which is a good beginners guide to the notation. Yes, it is a bit difficult to learn and takes quite a talent to actually use you can describe all of the C language (and the libraries!) in this notation. Don't ask ME to do it but I'm sure someone could do it. Semantics are quite difficult. Anyway... the point that I wanted to bring up is that in the next 10 years *someone* is going to come up with a new style of semantic notation. This will be an easier notation to use, to read, and it will truly be a break-through if it is machine-readable and can be used to make automatic code-generators. Now all we have to do is sit back and wait for someone to invent it! :-) -- Tom Limoncelli -- tlimonce@drunivac.Bitnet -- limonce@pilot.njin.net Drew University -- Madison, NJ -- 201-408-5389 [One problem that I still haven't seen adequately addressed is the mapping of abstract semantics onto real hardware. With grammars, the grammar- interpreting machine that you build via LR(1) or whatever perfectly implements the grammar that it interprets. With semantics, you have ugly problems with the behavior that the hardware wants to give you, e.g. overflow, alignment, rounding, and although it is possible to generate code that implements arbitrary semantics, the cost of doing so if the semantics is very far from that preferred by the hardware makes most of us compiler writers throw up our hands and give you what the hardware gives you. -John] -- 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