I've written a prototype ANSI C parser, which follows at the end of
this posting. Look it over. Perhaps I should post it to some sources
group. I'm open to suggestions.

I am aware that there are other parsers floating around, but I think this
one has some features which may prove useful, or at least interesting,
in the area of recognizing typedef-names.

At least two other parsers which have been submitted previously had some
measure of typedef-name capability.

One of them I have not seen, but according to the author, who was gracious
enough to correspond with me, it requires that typedef-names and only
typedef-names begin with capital letters. As I intend to use this as the
basis of real utilities, that was obviously not sufficient. I might have
used that one as a starting-point, but I was unable to obtain it via ftp,
due to technical problems.

I obtained the other off of the net about a year or two ago. I was unable
to understand much of the code without great difficulty. Maybe the fault
was all within my addled brain (synapse-rot), but there it is. I felt I
could never trust the program.

So I undertook to write a parser prototype that was straight-forward enough to
read and understand, and which has the capacity for defining and re-defining
typedef-names in a scoped name-space. You may judge whether or not I
succeeded. In any case, it will require quite a bit more work to make
it into anything real. If you do build something out of it, please send
me a copy!

It could probably be sped up by obviating a lot of calls to
malloc and free, and by streamlining the name-space lookup, which currently
searches a stack of hash-tables. It has no error-recovery. I may work on that
at a later date, but it's really not nearly so important as it used to
be when you submitted a program to a sysop and got your syntax-error
messages back the next day. (Nowdays turn-around is so fast that when I
get a bunch of messages from a compiler, I usually just fix the first
one and then feed it back to the compiler right away without even reading
the others, because fixing one thing often clears up several error-messages.)

The program has not been tested very much at all. If you find mistakes,
please let me know!

My email address is sun!megatest!djones.

Happy parsing,

Dave
[Works OK for me once I changed the oldspeak index and rindex into
strchr and strrchr in the lexer. -John]