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


On Tue, 17 Dec 2002 13:43:22 -0800, Paul Hilfinger <hilfingr@CS.Berkeley.EDU> said:

>> Unfortunately, some sort of distinction between types and non-types
>> seems to be hard-wired into the parser at a deep level: it seems to
>> be the parser's job to actually evaluate expressions corresponding
>> to types, whereas other expressions get evaluated by somebody else.

> Yes. This is a well-known issue with C++ parsing.

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.  Basically, what
the parser is trying to parse isn't a C++ expression (which, as you
point out, is ridiculously difficult if you really want to do it
correctly) but is instead either an expression or a type, so that the
same parser can be used unmodified for either GDB's 'print' command or
its 'ptype' command.

I could be wrong, though.

David Carlton
carlton@math.stanford.edu


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