|Parsing C with missing typedefs firstname.lastname@example.org (Bernt Kullbach) (1999-04-18)|
|Re: Parsing C with missing typedefs email@example.com (1999-04-19)|
|Re: Parsing C with missing typedefs firstname.lastname@example.org (1999-04-19)|
|From:||Bernt Kullbach <email@example.com>|
|Date:||18 Apr 1999 02:00:36 -0400|
|Keywords:||C, errors, question, parse, comment|
does anyone know how I can parse C when typedefs are missing.
You are eg. confronted with
typedef int INT;
When the first line is missing from the source code you get in troubles.
Within my lex/yacc-based parser I used the ANSI-grammar from
Kernighan/Ritchie. Using this grammar the scanner has to decide
if an integer-like token is a typedef name or not. I implemented this
feature using a symbol table for typedef names.
How can I proceed when type definitions can be missing. The scanner
cannot rely on his symbol table any more.
I tried operating with a lookahead in the identifier rule. But this does
not seem to be powerful enough.
Thanks for any help,
Bernt Kullbach (firstname.lastname@example.org)
[Seems pretty hard, since typedef in effect invents new keywords. Perhaps
some of the general purpose error correction work might be useful, or you
could do something gross and ad-hoc like backup and do a trial reparse
pretending the undefined identifier is a type. -John]
Return to the
Search the comp.compilers archives again.