home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18540 < prev    next >
Encoding:
Text File  |  1992-12-30  |  1.7 KB  |  39 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!usc!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!darwin.sura.net!uvaarpa!cv3.cv.nrao.edu!laphroaig!cflatter
  3. From: cflatter@nrao.edu (Chris Flatters)
  4. Subject: Re: template disappointments ... (suggesti
  5. Message-ID: <1992Dec30.161136.24591@nrao.edu>
  6. Sender: news@nrao.edu
  7. Reply-To: cflatter@nrao.edu
  8. Organization: NRAO
  9. References: <1hqnd6INNe83@agate.berkeley.edu>
  10. Date: Wed, 30 Dec 1992 16:11:36 GMT
  11. Lines: 26
  12.  
  13. In article 1hqnd6INNe83@agate.berkeley.edu, jbuck@foucault.berkeley.edu (Joe Buck) writes:
  14. >In article <24508@alice.att.com> ark@alice.UUCP () writes:
  15. >>In article <DSCHIEB.92Dec29133556@muse.cv.nrao.edu> dschieb@muse.cv.nrao.edu (Darrell Schiebel) writes:
  16. >>>         list<vector<int>> list_vec_int;
  17. >>
  18. >>Huh?? This works fine -- just remember to put a space between the
  19. >>two > characters so the >> won't be taken for a shift-right symbol.
  20. >
  21. >This is such a common error (and is so ugly) that compiler writers
  22. >would be well advised to add productions to their grammar that catch
  23. >it, or magic that splits the >> token into two tokens in this case
  24. >if that fits in with the compiler's structure.
  25. >
  26. >Yes, I know that the rules of lexical analysis force the >> to be one
  27. >token, but list<vector<int>> is a perfectly natural way of writing
  28. >this thing, so perhaps it should be permitted even at the cost of
  29. >adding an ugly rule to the grammar.
  30.  
  31. It requires more than a modification to the grammar (unless you find it
  32. acceptable to allow arbitrary amounts of whitespace in the middle of
  33. a right-shift operator).  You would have to switch lexical analysers
  34. while parsing a template declaration or a template class name and switch
  35. back afterwards.
  36.  
  37.     Chris Flatters
  38.     cflatter@nrao.edu
  39.