This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: c-exp.y
- From: David Carlton <carlton at math dot stanford dot edu>
- To: Paul Hilfinger <hilfingr at CS dot Berkeley dot EDU>
- Cc: gdb <gdb at sources dot redhat dot com>
- Date: 19 Dec 2002 11:58:28 -0800
- Subject: Re: c-exp.y
- References: <200212190336.TAA20859@tully.CS.Berkeley.EDU>
On Wed, 18 Dec 2002 19:36:22 -0800, Paul Hilfinger <hilfingr@CS.Berkeley.EDU> said:
>> 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.
Ah, gotcha. Good point. I'll have to think about what to do with
this, then. It seems like the two obvious options would be either to
have the lexer handle all double-colons, or else to have the lexer
handle none of them but to add a rule in the grammer converting a
possibly qualified name to a type.
And the former option doesn't work because the lexer doesn't have
enough smarts to let GDB do something useful with expressions of the
form C::x where x is a non-type member of C. And the latter option
probably won't work for the reasons you are bringing up.
Sigh. Certainly the short-term "fix" of extending the current hack in
yylex is looking more and more necessary.
David Carlton
carlton@math.stanford.edu