From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Mitchell To: Martin von Loewis Cc: egcs@cygnus.com Subject: Parsing templates as baseclasses Date: Sun, 01 Mar 1998 16:59:00 -0000 Message-id: <199803011702.RAA22550@quickstep.stanford.edu> References: <199803012359.AAA06557@mira.isdn.cs.tu-berlin.de> X-SW-Source: 1998-03/msg00011.html >>>>> "Martin" == Martin von Loewis writes: Martin> I'm trying to investigate the code As we speak, I'm engaged in the process of redoing the cp/parse.y from scratch, based directly on the grammar in the standard, with the addition of the GNU extensions that we currently support. This is an unauthorized, unsanctioned project; in particular, Jason's had nothing to do with it. I've discovered a number of odd parsing problems, and after poking around a bit, decided that some major changes were in order, especially now that the C++ grammar has (finally) stabilized. So, you might want to hold off; in a week or so I expect to submit the new (and hopefully much improved) grammar, which should be fully ISO-conformant. On the other hand, there's no guarantee whatsoever that this version will be in g++ any time soon; Jason will of course have to check it over with his usual eagle eye. Martin> namespace foo { Martin> template class x {}; Martin> } Martin> class y : public foo::x {}; Martin> I've got the lexer to produce, for the last line Martin> (AGGR `class') (IDENTIFIER_DEFN `y') (':')(VISSPEC) Martin> (NSNAME)(SCOPE) (PTYPENAME `x')('<')(TYPESPEC `int')('>') Martin> ('{') Martin> The last line is eventually reduced -> template_type. Martin> Then I get an error with the stack state stack now 0 1 4 Martin> 66 222 223 466 717 958 123 Martin> In the non-namespace case, the template_type is further Martin> reduced -> type_name -> nonnested_type -> base_class.1 Martin> Now, where should I put the support for Martin> namespace-qualified template types? I'll have to Martin> eventually reduce this to baseclass.1 as well, preferably Martin> without declaring foo::x a nested type (it isn't). Martin> Also, I'd like to avoid additional conflicts in the Martin> grammar. Martin> Any guidance appreciated. Martin> Martin -- Mark Mitchell mmitchell@usa.net Stanford University http://www.stanford.edu