Yes, something *like* that is possible, but it is rather tricky. The
switches in grammar rules that toggle typedef- recognition must be
situated very carefully, and in places that some may find
counter-intuitive. In the example above, "typedefRecOn" should be located
*after* "tTypedefName" and "tVoid", not before. (!)

Also (for purposes of maintainability if for no other reason), you want to
be sure that the scanner is always "eager" to do lookahead, not "lazy" in
states where a lookahead is not urgently needed to select a state-change.

A few months ago I posted a YACC/LEX program which, to the best of my
knowledge, does everything correctly, although given the trickiness of the
problem, I would not be astonished to hear otherwise.

Also I was under the false impression that ANSI C was meant to be a strict
extension of C, and therefore implemented some features of C-Classic which
ANSI C dropped, thinking the formal grammar I started from was "buggy".
Thus my statement that I thought the parser was "ANSI C" was technically
incorrect, although probably not enough so to cause any problems. It is
"ANSI C with C-Classic Extensions", I guess.
--