This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]