home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!sun-barr!cs.utexas.edu!uwm.edu!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!saimiri.primate.wisc.edu!sdd.hp.com!spool.mu.edu!agate!netsys!news!lsi!mhost!cl301!ameesh
- From: ameesh@lsil.com (Ameesh Desai)
- Newsgroups: comp.lang.c++
- Subject: Re: Need Yacc & Lex retargeted to C++
- Message-ID: <1992Nov16.201658.2862@lsil.com>
- Date: 16 Nov 92 20:16:58 GMT
- References: <1992Nov13.154107.21091@murdoch.acc.Virginia.EDU>
- Sender: news@lsil.com (news caster)
- Reply-To: ameesh@lsil.com
- Organization: LSI Logic Corporation
- Lines: 67
- Nntp-Posting-Host: cl301
-
- In article 21091@murdoch.acc.Virginia.EDU, cgh6m@darwin.clas.Virginia.EDU (Craig G. Hocker) writes:
- >This seems to be a topic of some interest, so I will mention a
- >C++ Parser Class Kit I came across by accident yesterday while
- >downloading another file. Nobody has mentioned it.
- >
- >anonymous ftp to export.lcs.mit.edu
- >
- > contrib/yacc.shar.Z
- >
- >
- >warning: it's a beta version, but the author does seem to be actively
- >soliciting people to modify and send him enhancements.
- >
- >I can't comment on it, since I haven't tried to do anything with it
- >yet.
- >
- >cgh6m@darwin.clas.virginia.edu
- >Craig G. Hocker
- >NSF-Center for Biological Timing
- >University of Virginia, Charlottesville, VA 22901
- >---- yep, that means I'm a scientist and not a computer jock! ----
-
-
- The implementation seems to encapsulate only the global yacc variables within a
- C++ class. In effect providing a C++ "wrapper" to yacc calls and vars.
-
- The problem with yacc is not its variables. Its making yacc understand C++
- class definations. You should ideally be able to write stuff like...
-
- %{
-
- class A { // some C++ class
- ...
- public:
- A(); // see note below ... this would cause problems with yacc
- };
-
- %}
-
- %union
- {
- int ival;
- float fval;
- char *sval
- A aclass; // make this work !
- }
-
- %type <aclass> rule_that_returns_a_class
-
- ....
- %%
-
- The fact that a class contains a ctor/dtor should not prevent it
- from being returned. The current yacc implementation depends on union for
- declaring the return type, and C++ will not allow a class with a ctor/dtor
- to be part of the union !
-
-
- Ameesh
-
-
- ---
- ______________________________ o__
- | _ /| Ameesh Desai \ ,>/_
- | \`O.o' LSI Logic Corp. \__(_)`(_)_ email: ameesh@lsil.com
- | =(_|_)= MS E192, 1501 McCarthy Blvd. \ fax : (408) 433-6802
- |____U_______Milpitas, CA 95035____________\____________voice: (408) 433-4097
-