LALR grammars for C and C++

Steven Pemberton steven at boring.uucp
Tue Feb 4 04:04:40 AEST 1986


In article <294 at isis.UUCP> dmiruke at isis.UUCP asks:
> Sometime back someone posted a question about an error in the LALR grammar
> given in the book 'C - A Reference Manual' by Harbison and Steele, in which
> there are two productions present that don't seem to be used anywhere at all
> in the rest of the grammar. I do not know if any solution or improvement was
> suggested by someone about this. If someone has any idea would like to hear
> about it.

In May 1985, Don Taylor posted the following corrections:

| There are a handful of typo's in the lalr(1) grammar in appendix c [of H&S].
| A letter to them resulted in a prompt reply from Mr. Harbison, and I quote
| ------------
| 
|      -Change all occurences of "..._ctype>" to "..._type>".
| 
|      -Remove definitions of "<008>" and "<key_dcltr>"; they are not needed.
| 
|      -"<decl or stmt>" should be "<dcl_or_stmt>".
| 
| In addition, if you have the first printing of the book, the production
| 
|      <cast_exp> ::= ( <typename_declaration> ) <prefix_exp>
| should be
|      <cast_exp> ::= ( <typename_declaration> ) <cast_exp>
| 
| You should also know that this grammar does not accomodate C's "old" form of
| initializers and compound assignments.
| ------------

Steven Pemberton, CWI, Amsterdam; steven at mcvax.uucp



More information about the Comp.lang.c mailing list