Article View: gnu.misc.discuss
Article #63069Need help with Flex and Bison question.
From: Victor Ma
Date: Sun, 19 Mar 1995 22:27
Date: Sun, 19 Mar 1995 22:27
27 lines
1390 bytes
1390 bytes
folks,
if this is not the right place for a flx and bison question, please do
let me know. i have just started using flex and bison with c++ on
DEC OSF1 V3.0
i am using flex to parse a text file and return string tokens to bison.
i have declared in my .y file
#define YYSTYPE char *
it seems to me that somewhere in yylex(), for every token found, the
token needs to be copied to a safe place and have its pointer returned
in yylval? like:
char * temp = new char [1024];
scanf ("%s", temp);
yylval = temp;
return (TOKEN_1);
this is a mess since bison probably won't know how to free the strings
after they have been used.
am i missing something? is there a better way to do this?
Victor Ma
Technical Details
Message-ID:
<3kib42$7ud@mrnews.mro.dec.com>Path:
arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!decwrl!pa.dec.com!mrnews.mro.dec.com!newsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1025b4,eadb6ce83ce85e84,start X-Google-Attributes: gid1025b4,public X-Google-ArrivalTime: 1995-03-19 14:32:46 PST Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!howland.reston.ans.net!vixen.cso.uiuc.edu!uwm.edu!lll-winken.llnl.gov!decwrl!pa.dec.com!mrnews.mro.dec.com!news From: Victor Ma <victor@cadsys.enet.dec.com> Newsgroups: gnu.misc.discuss Subject: Need help with Flex and Bison question. Date: 19 Mar 1995 22:27:14 GMT Organization: Digital Equipment Corporation - Marlboro, MA Lines: 29 Message-ID: <3kib42$7ud@mrnews.mro.dec.com> NNTP-Posting-Host: payoff.hlo.dec.com