help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: $x value lost?


From: Mhaxx
Subject: Re: $x value lost?
Date: Tue, 11 Mar 2003 09:31:57 +0100

BL> First, you wiped out the values with free() in the lexical analyzer.
BL> Second, beware using printf like that -- if your input is %s %d %x
BL> you'll have Big Problems.  Try:

BL> {kw_program} { yylval.string = strdup(yytext); return PROGRAM; }
BL> {kw_return}  { yylval.string = strdup(yytext); return RETURN; }
BL> {kw_end}     { yylval.string = strdup(yytext); return END; }

BL> start: PROGRAM RETURN END;    {
BL>      if ($1) { puts($1); free($1); }
BL>      if ($2) { puts($2); free($2); }
BL>      if ($3) { puts($3); free($3); }
BL> }

I don't understande where is the problema about printf. What does "puts()"
do and what does your parser do?

Mhaxx





reply via email to

[Prev in Thread] Current Thread [Next in Thread]