Newsgroups: comp.compilers
From: d...@math.mit.edu (Dale R. Worley)
Date: Wed, 15 Jan 1992 18:14:39 GMT
Local: Wed, Jan 15 1992 1:14 pm
Subject: Parsing C typedefs
[To the moderator: Even though the topic has been closed, I hope that
this article will be accepted anyway, since it describes how these problems were solved in a production compiler that handled all the tricky cases of ANSI C.] [This is the absolute definite last word on parsing typedefs. Really. -John] I worked on the parser for the Compass C compiler. The solution we used An identifier has to be inserted into the symbol table when the Making sure that tricky declarations like typedef int foo; are handled correctly is done by having the grammar of declarations volatile foo; is an empty declaration (and is illegal), while int foo; is a redeclaration of "foo" as an integer variable. To do this, the declaration-specifiers-without-type-specifier ::= declaration-specifiers-with-type-specifier ::= declaration ::= If the grammar is aware of these distinctions, it can be made LALR(1). Dale Worley Dept. of Math., MIT d...@math.mit.edu You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||