home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / cplus / 16020 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.7 KB  |  33 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!spool.mu.edu!umn.edu!csus.edu!netcom.com!erc
  3. From: erc@netcom.com (Eric Smith)
  4. Subject: Re: yacc and C++
  5. Message-ID: <1992Nov10.125745.14734@netcom.com>
  6. Organization: Netcom - Online Communication Services (408 241-9760 guest)
  7. References: <1992Nov9.013842.28215@cs.brown.edu>
  8. Date: Tue, 10 Nov 1992 12:57:45 GMT
  9. Lines: 22
  10.  
  11.  
  12. In article <1992Nov9.013842.28215@cs.brown.edu> hm@cs.brown.edu (Harry Mamaysky) writes:
  13. >I have a slight problem. I am trying to use a YACC generated parser in
  14. >a C++ system I have. This leads to the problem of getting YACC to know
  15.  
  16. I have found that using object oriented programming can drastically
  17. simplify parsers such that I don't need to use lex/yacc but can just
  18. write the scanner and parser directly in C++.  This makes it much more
  19. flexible and much easier to fine tune for speed and better error
  20. messages, etc.
  21.  
  22. I did that to implement a parser to parse C++, and was able to make it
  23. give much better error message context than most C++ compilers.  For
  24. example, if the error happens in a class and/or in a macro, a typical
  25. C++ compiler error message just says what the compiler thinks is wrong,
  26. but might not point out accurately the actual location in the code of
  27. the error, because by the time the code has been preprocessed, etc., a
  28. lot of the context information has been lost.  My C++ parser gives
  29. accurate context information in all error messages, and if the error is
  30. in a macro such that a typical C++ compiler would just show the macro
  31. call as the location of the error, mine shows both the macro call and
  32. the exact location inside the macro.
  33.