ANSI C grammar "pointer" production

Steven Gollery <sgollery@tuba.aix.calpoly.edu>
Wed, 12 Oct 1994 18:22:34 GMT

          From comp.compilers

Related articles
ANSI C grammar "pointer" production sgollery@tuba.aix.calpoly.edu (Steven Gollery) (1994-10-12)
Re: ANSI C grammar "pointer" production arthur@access.digex.net (1994-10-14)
| List of all articles for this month |
Newsgroups: comp.compilers
From: Steven Gollery <sgollery@tuba.aix.calpoly.edu>
Keywords: C, parse, question
Organization: Compilers Central
Date: Wed, 12 Oct 1994 18:22:34 GMT

Every ANSI-C grammar I've found on the net has a production like this
as part of declaring a variable or function:


pointer
: '*'
| '*' type_specifier_list
| '*' pointer
| '*' type_specifier_list pointer
;


The second and fourth alternatives confuse me. They appear to allow
token strings like:


* int
* double *
* float * int


and so on.


What C construct are these productions supposed to be parsing? I
can't think of a situation where it would be legal to have an
asterisk followed by a type name.


And more generally: is there a publication somewhere with an
annotated version of the ANSI C grammar -- something that would
explain the purpose of each production?


Steven Gollery
sgollery@tuba.aix.calpoly.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.