mao@hpclmao.HP.COM (Mike Ogush) (10/30/87)
The grammar for C (including Draft ANSI features) in appendix B of the 2nd
edition the book _C: A Refrence Manual_ by Harbison and Steele seems to
have a number of bugs in it:
p. 380 = appears twice in the production(s) for assignment-op
p. 382 The production for conditional-statement appears twice
The right-side of the production for const-type-specifier
should be in the font that indicates a reserved word not the
font for non-terminal symbols.
p. 383 There is a missing production:
declarator-list:
declarator
declarator , declarator
The symbol 'name' in the production for
direct-component-selection should be 'identifier'
There is a spurious line:
enumeration-constant = expression
p. 384 There is only one right-side in the production for
enumeration-type-definition, which is the concatenation of the
two given in the book.
p. 386 The symbol 'name' in the production for
indirect-component-selection should be 'identifier'
p .389 The symbol 'name' in the production for primary should be
'identifier'
p. 392 The right-side of the production for volatile-type-specifier
should be in the font that indicates a reserved word not the
font for non-terminal symbols.
Are there any bugs that I have missed? Are there better ways to fix the
problems that what I suggested above?
Mike Ogush
Computer Languages Lab
Hewlett-Packard Company
...!hplabs!hpclla!maokenny@uiucdcsb.cs.uiuc.edu (11/02/87)
/* Written 2:17 pm Oct 30, 1987 by mao@hpclmao.HP.COM in uiucdcsb:comp.lang.c */ > p. 380 = appears twice in the production(s) for assignment-op And |= doesn't appear at all. I suspect that |= was intended for the second appearance of =. > p. 383 > The symbol 'name' in the production for > direct-component-selection should be 'identifier' No, it should be `component-name' and there should then be a production: component-name: identifier , to document the semantic restriction. > p. 386 The symbol 'name' in the production for > indirect-component-selection should be 'identifier' > p .389 The symbol 'name' in the production for primary should be > 'identifier' The same comments about documenting the semantic restriction. You need the restriction, otherwise the declarations involving named types are impossible to handle. Thanks to Mike for pointing out these bugs. Kevin Kenny UUCP: {ihnp4,pur-ee,convex}!uiucdcs!kenny Department of Computer Science ARPA: kenny@B.CS.UIUC.EDU (kenny@UIUC.ARPA) University of Illinois CSNET: kenny@UIUC.CSNET 1304 W. Springfield Ave. Urbana, Illinois, 61801 Voice: (217) 333-8740
tom@hcx1.SSD.HARRIS.COM (11/12/87)
More errors in Harbison and Steele Grammar as published:
In definition of inner-declaration-list the nonterminal
initialized-declaration-list is referenced, but is not
defined anywhere. Should add:
initialized-declaration-list :
initialized-declaration
initialized-declaration-list initialized-declaration
In definition of type-specifier the symbol floating-point-type-specifier
should be just floating-type-specifier
The definition of type-specifier-list is missing a production. It should
read:
type-specifier-list :
type-specifier <-- missing
type-specifier-list type-specifier
In case anyone is interested in such trivia -- after fixing all the
bugs, running the grammar through a LALR(1) parser generator
results in 40 states with conflicts. The grammar published in
the draft ANSI C standard only has 14 states with conflicts.
Also one of the previously posted corrections is wrong:
> p. 383 There is a missing production:
>
> declarator-list:
> declarator
> declarator , declarator
Should read:
p. 383 There is a missing production:
declarator-list:
declarator
declarator-list , declarator
------------------------------------------------------------------------
tahorsley@hcx1.harris.com | Aging - just say no!
------------------------------------------------------------------------