Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!oliveb!apple!claris!hearn From: hearn@claris.com (Bob Hearn) Newsgroups: comp.lang.misc Subject: Re: Language Design Message-ID: <9165@claris.com> Date: 23 Mar 89 18:48:07 GMT References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <9122@claris.com> <12606@watdragon.waterloo.edu> <9162@claris.com> <89Mar23.094504est.4328@turing.toronto.edu> Reply-To: hearn@claris.com (Bob Hearn) Organization: Claris Corporation, Mountain View CA Lines: 44 In article <89Mar23.094504est.4328@turing.toronto.edu> holt@turing.toronto.edu (Ric Holt) writes: >In my modest opinion, Bob Hearn is doing a fine job of entertaining us >with his emotional outbursts, but a considerable disservice with his >claims. Likely, Cormack is correct and Hearn is wrong. Likely >C's grammar is not Context Free. OK, OK, I'm sorry. I'm new to the net, and I wasn't expecting to get flamed *quite* so much for one simple correction... it just became very annoying. I'll try to restrict my responses to computer science from now on. >I believe Cormack (in his academic way) has proven Hearn wrong. I believe >C's grammar has the appearance of a context free grammar but that it >violates the mathematical def of context free. > >This question (is C's grammar context free) is >important and we should get a clear answer to it rather than outbursts. >Could someone please settle this definitely? > Ric Holt Good idea. Although I think this whole argument is founded on misunderstandings. It all depends on what you mean by "context-free grammar." If you follow the technical definition, then there is no question that C's grammar (as specified in K&R) is context-free. As for Cormack's claim that C does not have a finite set of terminals, I can't say that I really understand what he means. Perhaps he is referring to the fact that there is an infinite number of identifiers? Well, if we restrict ourselves to K&R, then the terminal in question is simply (identifier), and it does not decompose further. If we want to make this grammar more concrete and have it generate the actual language that a compiler accepts, then we would have identifiers producing strings over the char. set. In this case, the char. set is the set of terminals, and it is certainly finite. BTW, the real argument here is not whether C's grammar satisfies some mathematical definition. It does, but it is not a particularly relevant piece of information. The only reason I claimed it *did* was that someone, a long time ago, made some comment on how screwed up C's grammar was, and that it wasn't context-free. Well, as I don't think C's grammar is particularly screwed up relative toother languages' grammars, I responded. I happen to like C, and I don't like C-bashing. Guess I learned my lesson, huh? Bob Hearn hearn@claris.com