YACC grammer for c

karsh at nicmad.UUCP karsh at nicmad.UUCP
Fri Nov 28 15:38:37 AEST 1986


[]

  Pardon me if this has been discussed here before.

  I tried to write a yacc grammer for the C language by using the
grammer in K&R appendix A.  I typed in the grammer from the book almost
verbatim.  I've found the following anomaly:

     Under the definition for "function-body" there is a reference to
     the non-terminal "type-decl-list".  However, "type-decl-list" is
     not defined anywhere.

  Is there any difference between "type-decl-list" and "struct-decl-list"?
I.e. can I get away with:

         type-decl-list : struct-decl-list ;

  By the way, does anybody know if there are any known bugs in the K&R
C grammer?  What's a good reference for information on the precise
syntax of the C language?

   Does anybody out there have a yacc grammer for the C language?  How
about for the ANSI C language?  Could you send me a copy?

                          Thanks,

                          Bruce Karsh
                          {ihnp4,uwvax}!nicmad!karsh



More information about the Comp.lang.c mailing list