E
eliben
Hello,
I'm working on a parser for ANSI C (http://code.google.com/p/
pycparser/), and it was reported that the parser chokes on the
following code:
typedef struct tagEntry tagEntry;
struct tagEntry
{
char* key;
char* value;
} Entry;
The reason for its choking is that the first line defines tagEntry as
a type, and the parser then can't parse the struct declaration
correctly, because following the C grammar (as defined in K&R2), a
known type can't follow the keyword 'struct', but only an identifier.
Is this correct? GCC seems to parse this just fine, why is that?
Thanks in advance
Eli
I'm working on a parser for ANSI C (http://code.google.com/p/
pycparser/), and it was reported that the parser chokes on the
following code:
typedef struct tagEntry tagEntry;
struct tagEntry
{
char* key;
char* value;
} Entry;
The reason for its choking is that the first line defines tagEntry as
a type, and the parser then can't parse the struct declaration
correctly, because following the C grammar (as defined in K&R2), a
known type can't follow the keyword 'struct', but only an identifier.
Is this correct? GCC seems to parse this just fine, why is that?
Thanks in advance
Eli