home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- 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
- From: erc@netcom.com (Eric Smith)
- Subject: Re: yacc and C++
- Message-ID: <1992Nov10.125745.14734@netcom.com>
- Organization: Netcom - Online Communication Services (408 241-9760 guest)
- References: <1992Nov9.013842.28215@cs.brown.edu>
- Date: Tue, 10 Nov 1992 12:57:45 GMT
- Lines: 22
-
-
- In article <1992Nov9.013842.28215@cs.brown.edu> hm@cs.brown.edu (Harry Mamaysky) writes:
- >I have a slight problem. I am trying to use a YACC generated parser in
- >a C++ system I have. This leads to the problem of getting YACC to know
-
- I have found that using object oriented programming can drastically
- simplify parsers such that I don't need to use lex/yacc but can just
- write the scanner and parser directly in C++. This makes it much more
- flexible and much easier to fine tune for speed and better error
- messages, etc.
-
- I did that to implement a parser to parse C++, and was able to make it
- give much better error message context than most C++ compilers. For
- example, if the error happens in a class and/or in a macro, a typical
- C++ compiler error message just says what the compiler thinks is wrong,
- but might not point out accurately the actual location in the code of
- the error, because by the time the code has been preprocessed, etc., a
- lot of the context information has been lost. My C++ parser gives
- accurate context information in all error messages, and if the error is
- in a macro such that a typical C++ compiler would just show the macro
- call as the location of the error, mine shows both the macro call and
- the exact location inside the macro.
-