Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #1654

stop yyparse() at <<EOF>>

Path csiph.com!xmission!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From Jens Kallup <jkallup@web.de>
Newsgroups comp.compilers
Subject stop yyparse() at <<EOF>>
Date Tue, 22 Dec 2015 16:29:35 +0100
Organization Aioe.org NNTP Server
Lines 59
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <15-12-007@comp.compilers> (permalink)
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 8bit
Injection-Info miucha.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="69261"; mail-complaints-to="abuse@iecc.com"
Keywords yacc, lex, question
Posted-Date 22 Dec 2015 11:22:09 EST
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:1654

Show key headers only | View raw


Hello,

I work on multiple parser's in a GUI.  When I start 1st, the code
generation is fine.  But, when I start 2nd start, the code generator
produce some junk.  I have used "yyterminate();" but this seems to not
help.

The source:
? "Ploppers" + "ppp" + "huhu"

The pre-processed text file:
#output asm, cli
? "Ploppers" + "ppp" + "huhu"

The first pass (flex):
1: "Ploppers"
  plus
  2: "ppp"
  plus
  2: "huhu"

The second pass:
#output asm, cli? 2: "Ploppers"
  plus
  2: "ppp"
  plus
  2: "huhu"
Segmentation fault


\#"output cpp"      { outype = 0; return _CPP_PARSER_; }
\#"output asm"      { outype = 1; return _ASM_PARSER_; }
\#"output asm, cli" { outype = 1; return _ASM_PARSER_; }

(\"([a-zA-Z0-9_])*\")* {
   printf("1: %s\n",yytext); strcpy(yytext,"");
   BEGIN(STRINGER);
   strcpy(yytext,"");
}
<STRINGER>{
(\"([a-zA-Z0-9_])*\")* { printf("2: %s\n",yytext);
   strcpy(yytext,""); BEGIN(STRINGER); strcpy(yytext,"");
}
\+        { printf("plus\n"); BEGIN(STRINGER); }
\n
}


I would like use it in gnu "bison" so:

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


Is that a Bug, or my mistakes?

TIA
Jens

Back to comp.compilers | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

stop yyparse() at <<EOF>> Jens Kallup <jkallup@web.de> - 2015-12-22 16:29 +0100
  Re: stop yyparse() at <<EOF>> Kaz Kylheku <kaz@kylheku.com> - 2015-12-27 10:59 -0500

csiph-web