Grammar for C

Arnold Robbins arnold at gatech.CSNET
Thu May 2 03:49:35 AEST 1985


> Various people have asked about the availability
> of a grammar for C.  The book "A C Reference Manual"
> by Harbison & Steele (Prentice-Hall) contains a
> complete LALR(1) grammar for the language.
> 
> 	Glen McCluskey
> 	..tektronix!mako!glenm

Unfortunately, the grammar (along w/the rest of the book) is copyrighted
by the publisher, which will may be a problem should you wish to base
your C compiler on their grammar.  I know that Guy Steele is on the net
someplace; maybe he has something more authoritative to say about this.

On the other hand, the grammar given in the current draft(s) of the ANSI
C standard can be easily made LALR(1).  A YACC grammar based on the Nov 11
draft was posted awhile back by my office mate, Jeff Lee (gatech!jeff).
It is for the ANSI C, but could be easily made K&R C w/very little work.

Check your archives for net.sources for it, or if enough requests come
flooding in (as will probably happen), we'll repost it.
-- 
Arnold Robbins
CSNET:	arnold at gatech	ARPA:	arnold%gatech.csnet at csnet-relay.arpa
UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold

How come nobody likes good ideas when they don't come up with them?



More information about the Comp.lang.c mailing list