Re: [Flex-help] flex 2.6.0 lexer cannot be restarted on Solaris 11.3
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Mark B. <cha...@ya...> - 2016-06-08 16:19:29
|
It looks like a lexer issue to me. I've uploaded a simple test case here: https://sourceforge.net/projects/prose/files/prose/0.10.0/test-parser.tar.gz/download Compile with gmake on Solaris 11.3 and run: ./parse one two Compare with output from your favourite Linux. Thanks,Mark. Sent from Yahoo Mail on Android On Tue, 7 Jun, 2016 at 4:48, Will Estes<wes...@gm...> wrote: On Saturday, 4 June 2016, 7:28 am +0000, Mark Bannister <cha...@ya...> wrote: > Hi, > > > I'm having trouble with flex here (flex 2.6.0 and bison 3.0.4). I can get it working fine on numerous Linux platforms, but it is misbehaving on Solaris 11.3 and I cannot get to the bottom of it. The lexer is compiled on Fedora, then I do a make dist and copy the tarball to Solaris 11.3 and compile there, so flex (and bison) have run on Fedora not on Solaris. However, this is what I am getting on an assembler tool of mine that is supposed to parse two separate input files, one after the other, by calling the lexer two times in succession: Are you sure that the problem is in the lexer? Is it possible that it's in the parser? Can you trim down the lexer and post the result so it's possible to see the code that's causing you trouble? > $ prism -m test17 test17a > prism: test17a.pal line 1: syntax error at '' > *** ERROR(S) OCCURRED DURING COMPILATION > > Needless to say that test17.pal is not an empty file, and it assembles just fine on a Linux platform. If I swap the filename arguments around: > $ prism -m test17a test17 > prism: test17.pal line 1: syntax error at '' > *** ERROR(S) OCCURRED DURING COMPILATION > > ... so the problem is occurring with the second file given to the lexer, whatever that file happens to be. Now with some debug: > $ prism -D50 -m test17 test17a<snip>Next token is token FUNC_RTN () > Shifting token FUNC_RTN () > Entering state 134 > Reading a token: Now at end of input. > Reducing stack 0 by rule 519 (line 1647): > $1 = token FUNC_RTN () > -> $$ = nterm func_rtn () > Entering state 311 > Reducing stack 0 by rule 137 (line 245): > $1 = nterm func_rtn () > -> $$ = nterm line () > Entering state 851 > Reducing stack 0 by rule 2 (line 108): > $1 = nterm lines () > $2 = nterm line () > -> $$ = nterm lines () > Entering state 175 > Now at end of input. > Shifting token $end () > Entering state 850 > Cleanup: popping token $end () > Cleanup: popping nterm lines () > Starting parse > Entering state 0 > Reading a token: Now at end of input. > prism: test17a.pal line 1: syntax error at '' > Cleanup: discarding lookahead token $end () > *** ERROR(S) OCCURRED DURING COMPILATION > > Compared with the same debug output on Linux: > Next token is token FUNC_RTN () > Shifting token FUNC_RTN () > Entering state 134 > Reading a token: Now at end of input. > Reducing stack 0 by rule 519 (line 1647): > $1 = token FUNC_RTN () > -> $$ = nterm func_rtn () > Entering state 311 > Reducing stack 0 by rule 137 (line 245): > $1 = nterm func_rtn () > -> $$ = nterm line () > Entering state 851 > Reducing stack 0 by rule 2 (line 108): > $1 = nterm lines () > $2 = nterm line () > -> $$ = nterm lines () > Entering state 175 > Now at end of input. > Shifting token $end () > Entering state 850 > Cleanup: popping token $end () > Cleanup: popping nterm lines () > Starting parse > Entering state 0 > Reading a token: Next token is token LABEL () > Shifting token LABEL () > Entering state 167 > > So the debug isn't really helping me see the problem. I've tried truss, but it isn't helping me either: > $ truss -f -r all -w all -o /tmp/mb.truss ../../src/prism/prism -D50 -m test17 test17a > Examining the output, I'm closing fd 0 at the end of processing the first file, then I open the next file on fd 0, but not a single byte is read from the second file. > I have tried YY_FLUSH_BUFFER and BEGIN INITIAL after yyparse() returns, and I have also tried calling yylex_destroy() here too. But there is no change. > Please can someone help me determine which stubborn global is not being reset, and the correct way to reset it? > The code is here: PROSE Programming Language / Mercurial / [5c41ac] /src/prism/lexer.l ... due to the magic of SourceForge the web view has no line numbers, but look for the Pal_lexer() function and then where it calls yyparse(). > > | | > | | | | | | > | PROSE Programming Language / Mercurial / [5c41ac] /src/prism/lexer.l1679 lines (1511 with data), 44.4 kB | > | | > | View on sourceforge.net | Preview by Yahoo | > | | > | | > > > ... it is called in a loop from here: PROSE Programming Language / Mercurial / [5c41ac] /src/prism/prism.c > > | | > | | | | | | > | PROSE Programming Language / Mercurial / [5c41ac] /src/prism/prism.c/* ***************************************************************************** * * This source code can be downloaded from prose.sourceforge.net * | > | | > | View on sourceforge.net | Preview by Yahoo | > | | > | | > > > Thanks in advance,Mark. > > > > > > ------------------------------------------------------------------------------ > What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic > patterns at an interface-level. Reveals which users, apps, and protocols are > consuming the most bandwidth. Provides multi-vendor support for NetFlow, > J-Flow, sFlow and other flows. Make informed decisions using capacity > planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e > -- > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help -- Will Estes Flex Project Maintainer wes...@gm... https://github.com/westes/flex |