Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!brl-tgr!tgr!ucla-cs!ekrell@mit-bugs-bunny.arpa From: ekrell@mit-bugs-bunny.arpa Newsgroups: net.lang.c Subject: Re: C not LALR(1) & compiler bugs Message-ID: <1969@brl-tgr.ARPA> Date: Sat, 25-Jan-86 12:43:07 EST Article-I.D.: brl-tgr.1969 Posted: Sat Jan 25 12:43:07 1986 Date-Received: Sun, 26-Jan-86 20:06:58 EST Sender: news@brl-tgr.ARPA Lines: 21 > C's grammar is CONTEXT SENSITIVE !? Can it be ?! First of all, the term "context sensitive" is incorrect. C's grammar is context free since every production in the grammar has exactly one non-terminal in its left hand side. The problem is the grammar is ambiguous, i.e., some programs have more than one parse tree. This is nothing out of the ordinary. Lots of languages have ambiguous "official" grammars. Even Ada does. For instance, is A(1) a reference to element 1 of an array A or is it a call to function A with 1 being an argument ??. You can't distinguish between the two syntactically. Please note that these two examples are not an indication of the language being ambiguous, only that a particular grammar is ambiguous. You can easily solve these two ambiguities by changing the grammar. In the Ada example, you simply don't distinguish in the grammar between array references and function calls and let the semantic phase do the required checking. -- Eduardo Krell UCLA Computer Science Department ekrell@ucla-locus.arpa ..!{sdcrdcf,ihnp4,trwspp,ucbvax}!ucla-cs!ekrell