Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!pyramid!prls!philabs!linus!raybed2!rayssd!mirror!frog!john From: john@frog.UUCP (John Woods) Newsgroups: comp.lang.misc Subject: Re: Language Design Message-ID: <1163@frog.UUCP> Date: 26 Mar 89 23:12:00 GMT References: <5200040@m.cs.uiuc.edu> <12443@watdragon.waterloo.edu> <9165@claris.com> Organization: Misanthropes-R-Us Lines: 25 In article <9165@claris.com>, hearn@claris.com (Bob Hearn) writes: > >C's grammar is not 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. I think the crux of the argument of the non-context-free crowd is that the grammar in K&R does NOT actually specify the C language by itself, not as a grammar. It relies on the trick of telling the lexer about typedefs, which is a form of back-door context. Consider: if you wrote a YACC specification of C according to the context-free grammar, but omitted any kind of action clauses (perhaps you want to turn on debugging and watch the state machine play, a fine entertainment for a rainy day), it would NOT be able to correctly parse a C program with typedefs (unless, of course, you hid a "real" C grammar (with actions and the ever present back-door gimmick) in the lexer itself). When the pro-context-free crowd's argument is presented as "So what; it is close enough, and it works", the argument in convincing. When it is presented as "Yeah, well, your mother wears army boots!", it isn't. -- John Woods, Charles River Data Systems, Framingham MA, (508) 626-1101 ...!decvax!frog!john, john@frog.UUCP, ...!mit-eddie!jfw, jfw@eddie.mit.edu Remainder Khomeini!