evil@arcturus.UUCP (Wade Guthrie) (10/26/89)
I have the feeling that I am going to feel very stupid for asking this. . . I have seen requests for a YACC grammar for C (which I never thought I'd need until now), but I can't find any reference to it in our archives. Does anyone have one? Wade Guthrie evil@arcturus.UUCP Rockwell International Anaheim, CA (Rockwell doesn't necessarily believe / stand by what I'm saying; how could they when *I* don't even know what I'm talking about???)
vik@mentor.cc.purdue.edu (Vik Lall) (10/27/89)
In article <6368@arcturus>, evil@arcturus.UUCP (Wade Guthrie) writes: > I have seen requests for a YACC grammar for C (which I never thought I'd need > until now), but I can't find any reference to it in our archives. Does anyone > have one? look at : uunet.uu.net:~ftp/net.sources/ansi.c.grammar.Z Here is the README from that shar.. enjoy.. The files in this directory contain the ANSI C grammar from the April 30, 1985 draft of the proposed standard. This copy also incorporates all bug fixes I have seen since the last two postings. With a little work this grammar can be made to parse the C that most of us know and love (sort of). There is one bug fix to the grammar that is in this posting. On line 295 of gram.y it previously read declaration_specifiers instead of type_specifier_list as it does now. I believe the folks at the ANSI committee made a mistake since if you replace the line with what the original read you will end up with 16 shift/reduce errors and 2 reduce/reduce errors (the good ones). As it is, it only has 1 shift/reduce error that occurs on the if/else construct. YACC creates the correct parser and I don't want to ugly my grammar up. Anyway, all cumquats unite and generate this sucker. Then just sit and play with it. Remember, the grammar accepts things like "Hello, world"++; --1.23456; *'a' but this is not a bug, but simply a shuffling of the checking into the semantic analysis. If you want to hack it up to do lvalue and rvalue checking, I'm sure the ANSI committee would be glad to have your changes. Don't send'em to me though. I don't want'em. Wear this in good health. Jeff Lee gatech!jeff jeff@gatech jeff%gatech.CSNet@CSNet-Relay.ARPA --- Vik Lall vik@mentor.cc.purdue.edu Purdue University Computing Center lall@purccvm
khera@juliet.cs.duke.edu (Vick Khera) (10/28/89)
In article <6368@arcturus> evil@arcturus.UUCP (Wade Guthrie) writes: >I have the feeling that I am going to feel very stupid for asking this. . . >I have seen requests for a YACC grammar for C (which I never thought I'd need >until now), but I can't find any reference to it in our archives. Does anyone >have one? > >Wade Guthrie yes. if you send me e-mail with an address i can mail back to you from, i'll send you a copy. and guess what, i'll even include a LEX scanner for it absolutely FREE!!! vick =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ARPA: khera@cs.duke.edu Department of Computer Science CSNET: khera@duke Duke University UUCP: {mcnc,decvax}!duke!khera Durham, NC 27706
werg8009@uxa.cso.uiuc.edu (10/22/90)
Does anyone know where I can get a complete YACC grammar for C? Thanks in advance.
bhoughto@cmdnfs.intel.com (Blair P. Houghton) (10/23/90)
In article <47600015@uxa.cso.uiuc.edu> werg8009@uxa.cso.uiuc.edu writes: > >Does anyone know where I can get a complete YACC grammar for C? Why is it that everyone who asks this fails to ask for the lex(1) tokenizer as well? --Blair "I have neither; I'm just curious."