Re: stop yyparse() at <<EOF>>

Kaz Kylheku <>
Sun, 27 Dec 2015 10:59:48 -0500 (EST)

          From comp.compilers

Related articles
stop yyparse() at <<EOF>> (Jens Kallup) (2015-12-22)
Re: stop yyparse() at <<EOF>> (Kaz Kylheku) (2015-12-27)
| List of all articles for this month |

From: Kaz Kylheku <>
Newsgroups: comp.compilers
Date: Sun, 27 Dec 2015 10:59:48 -0500 (EST)
Organization: NNTP Server
References: 15-12-007
Injection-Info:; posting-host=""; logging-data="30871"; mail-complaints-to=""
Keywords: lex, debug, comment
Posted-Date: 27 Dec 2015 10:59:48 EST

On 2015-12-22, Jens Kallup <> wrote:
> (\"([a-zA-Z0-9_])*\")* {
> printf("1: %s\n",yytext); strcpy(yytext,"");
> strcpy(yytext,"");

[ snip ]
> Is that a Bug, or my mistakes?

Not saying this is the crash, but do not modify yytext; it is (or may
be) a pointer directly into the lexical analyzer's buffer, and not a

You might be confusing the flex scanner somehow by putting a null in

> string_expr
> : _STRING_ { printf("---> %s\n",yylval.text); }
> ;

You haven't shown any lexer code which sets up yylval.text and returns
the _STRING_ token.

The lex rules you have surrounding your STRINGER state don't return

[Good points. In recent versoins of flex, yytext points into the
input buffer and chaning what it points to is asking for trouble.
If you need to change it, make a copy.
Also, there's no BEGIN(INITIAL) to reset the start states. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.