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


Groups > comp.compilers > #1654

stop yyparse() at <<EOF>>

From Jens Kallup <jkallup@web.de>
Newsgroups comp.compilers
Subject stop yyparse() at <<EOF>>
Date 2015-12-22 16:29 +0100
Organization Aioe.org NNTP Server
Message-ID <15-12-007@comp.compilers> (permalink)

Show all headers | 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