This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: c-exp.y
- From: Paul Hilfinger <hilfingr at CS dot Berkeley dot EDU>
- To: David Carlton <carlton at math dot stanford dot edu>
- Cc: gdb <gdb at sources dot redhat dot com>
- Date: Wed, 18 Dec 2002 19:36:22 -0800
- Subject: Re: c-exp.y
> I have heard that C++ parsing is a royal pain, but I'm not sure that's
> the issue here: I suspect that GDB's problems are at a more basic
> level. I suspect that the division of labor between what the
> parse_expression does and what eval_expression does is a bit funny,
> and I'm pretty sure that the rule
>
> start : exp1
> | type_exp
> ;
>
> in the parser leads to some conceptual incoherence.
It does, but it is not alone, which I guess was my point. Look
further down in the grammar, and you find
exp : '(' type ')' exp %prec UNARY
...
;
exp : '(' exp1 ')'
{ }
which is essentially the same thing all over again.
The point is that there are instances in the C/C++ grammar that require
knowing whether a given identifier or qualified name is or is not a
type, which is why this sort of stuff tends to migrate into lexical
analysis.
Paul Hilfinger