Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!usc!jarthur!uci-ics!rfg From: rfg@ics.uci.edu (Ronald Guilmette) Newsgroups: comp.lang.c++ Subject: Re: zortech problem with lex Message-ID: <26073795.10139@paris.ics.uci.edu> Date: 21 Mar 90 08:13:09 GMT References: <6300008@ux1.cso.uiuc.edu> <24800002@sunb6> <25ECE752.29589@paris.ics.uci.edu> <10541@alice.UUCP> <6553@cadillac.CAD.MCC.COM> <25F8C92A.9349@paris.ics.uci.edu> <3742@tukki.jyu.fi> Reply-To: rfg@ics.uci.edu (Ronald Guilmette) Organization: UC Irvine Department of ICS Lines: 43 In article <3742@tukki.jyu.fi> sakkinen@jytko.jyu.fi (Markku Sakkinen) writes: >In article <25F8C92A.9349@paris.ics.uci.edu> rfg@ics.uci.edu (Ronald Guilmette) writes: >>In article <6553@cadillac.CAD.MCC.COM> ned@MCC.COM (Ned Nowotny) writes: >>> >>>Given the imprecise nature of the C++ specification, I am more than a >>>little disappointed that the language does not have a grammar expressible >>>in BNF form that will accept all legal strings and reject all illegal >>>strings. >> >>As Joe English also points out, this is utter nonsense. [...] >>>... While it may be >>>true that some LALR(1) grammar will accept all legal C++ strings, the fact >>>that the grammar must also accept illegal strings makes the claim that >>>C++ is somehow a LALR(1) language something less than useful. >> >>I agree that in practice, nobody actually is stupid enough to use V* as their >>LALR(1) grammar for parsing C++ or other languages, but just because the >>statement "C++ is LALR(1)" may not be "useful" does not mean that it is >>not 100% accurate. In fact, I believe that it is. > >Sorry, Mr. Guilmette, I think it is _you_ who are repeating the same >utter nonsense too many times in this group. Please stand back for >a while and reflect on how vacuous any grammatical classification >of languages becomes is one takes your attitude. Alternatively, >go post your opinion to the comp.theory group (or comp.compilers) >and get your knuckles rapped on by real experts. I believe that I failed to make my point clearly enough. I used the (admitedly extreme) example of V* as a grammar for C++ just to make it quite evident that a C++ grammar could be LALR(1). I only did this for the sake of argument. As should be demonstrated by Jim Roskind's grammar, you need not devolve the grammar all the way down to V* to get it to be LALR(1). Quite the contrary. If you are willing to do just a few more things with semantic analysis rather than syntax analysis (relative to what current C++ implementors seem to be doing) then you can in fact have a useful and practical LALR(1) grammar for C++. That was my point. I just stated it badly. // Ron Guilmette (rfg@ics.uci.edu) // C++ Entomologist // Motto: If it sticks, force it. If it breaks, it needed replacing anyway.