YACC grammar for C language

Doug Gwyn gwyn at smoke.BRL.MIL
Sat Jan 14 21:57:23 AEST 1989


In article <1183 at goofy.megatest.UUCP> djones at megatest.UUCP (Dave Jones) writes:
-In article <175 at calmasd.GE.COM>, jhh at calmasd.GE.COM (Jung Hamel) writes:
->    Does anybody have or know of YACC grammar for C that does
-> not require the lexical analyser to differentiate typedef
-> names from other identifier names?
-Nope, nobody does. There ain't know such thing. If type-names
-are treated the same as identifiers, C is inherently ambiguous.

More precisely, type names must be taken into account when parsing C.
There are cases where the wrong parse will result if this isn't done.

-I have a suspicion that the C grammar that has been circulating on the
-net for the last year or two, with the comment that all it needs is a
-lexical analyzer, is, in reality, a rather arcane practical joke.

No, I think the people who keep requesting a copy of it really do think
that all they need to do is feed it to YACC and that will take care of
the syntactic phase of a C compiler.  Of course, they're mistaken..



More information about the Comp.lang.c mailing list