Related articles |
---|
integrating a parser into a C++ class peterd@snapsystems.com (Peter Daniels) (1999-05-16) |
From: | Peter Daniels <peterd@snapsystems.com> |
Newsgroups: | comp.compilers |
Date: | 16 May 1999 15:26:36 -0400 |
Organization: | SNAP Systems, Inc. |
Keywords: | C++, yacc, question |
I am trying to integrate a flex/bison parser into a C++ class. I want
to be able to Instatiate a parser object with a CString (MFC) object
(which loads a member variable with that string), tell the parser to
use the string in a member function by using yy_scan_string and
yyparse, then have the output of the parser placed in a class member
CString object, and finally delete the buffer with yy_delete_buffer.
Then I want to be able to reset the parser input string member
variable and parse again ad infinitum.
I'm having trouble with a few areas:
1) how do I make it so my class member functions have access to all of
the functions, structs, etc. found in the yy.l.cpp and yy.cpp files
created by flex and bison.
2) how do I make my parser place its output in the member variable of my
class?
3) how do I allow my bison rules to use another object that has
transformation data in it?
Yes, most of my questions probably relate more to scoping rules than
compiler design, but I believe the questions are still relevant to this
newsgroup and may be helpful to others.
Thanks,
Peter
Return to the
comp.compilers page.
Search the
comp.compilers archives again.