Re: [Flex-help] lex/yacc/gcc help (RESOLVED)
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Mark H. <ma...@co...> - 2013-11-08 18:57:16
|
On 11/06/2013 07:57 AM, Mark Hounschell wrote: > On 11/06/2013 03:19 AM, Akim Demaille wrote: >> >> Le 5 nov. 2013 ? 14:11, Mark Hounschell <ma...@co...> a »crit : >> >>> Thanks Akim, >> >> Hi! >> >>> Like I said in my original post, I am yacc/lex ignorant. The strange thing, that I haven't mentioned is that this all built successfully 4, 5, or more years ago on Linux. >> >> I would not have expected that, given what you sent. >> >>> I was recently able to find that executable that I had checked into CVS those years back and it works. I also found some notes of what I originally had to do to get it to build. All I had to do back then was: >>> >>> 1. Changed all ocurrances of yylval.ntype >>> to yylval.nvaltype.ntype >>> 2. Changed all occurances of yylval.nval >>> to yylval.nvaltype.nval >>> >>> 3. Changed all occurances of yybgin to yy_start >>> >>> 4. Changed all occurrences of "k =/ 10" to "k /= 10" >> >> Wow, that piece of software _is_ old! Could you tell us what >> it is? >> > > It's a micro code assembler for a legacy CPU boards micro engine. It is > an early 80s generation CPU board. From back in the days when powerfull > CPUs were not yet on a chip. I still repair these boards and often a > micro diagnostic has to be modified to create tight scope loops. The > peice of software I'm trying to build creates the assembler used to > compile the micros and firmware for this board. There was a time this > peice of software was "Company private". That was long ago though. I > would have no problem providing the code if it would help me get it to > build again? > >>> As far as including the whole scanner in the yacc file, the y.tab.c file does include the lex file but at the very end of it. After this BEGIN shows up. >> >> BEGIN is a macro, so it must be #defined before it is >> used. >> >>> I assume lex.yy.c is the whole scanner? >> >> Yes, that's what I meant. >> >>> And I also assume you mean trying to include it before the BEGIN? >> >> To include it before the body of the parser. You'll have to find >> the right place, as the scanner certainly also wants to "see" things >> from the parser, such as YYSTYPE I guess. >> > > Since I don't remember what version of SuSE Linux I used when it > actually did built right, I might just get out all my old dist CDs and > see if I can pin down the versions that did work. > > Regards > Mark I have determined it was SuSE-8.2 that the working executable was built on. Verified by installing a SuSE-8.2 system and it builds just fine. SuSE-8.2 has the following revisions of software #rpm -q gcc glibc yacc flex bison gcc-3.3-23 glibc-2.3.2-6 yacc-91.7.30-663 flex-2.5.4a-97 bison-1.75-39 What I've found is lex/flex is NOT the problem at all. The problem is bison -y is NOT doing the same thing yacc does. On the 8.2 system the makefile specifies "YACC = yacc". If I change it to "YACC = bison -y", I get the same failure I do on the current system. But, I found a package called byacc. Using this instead of "bison -y" or "yacc" has fixed my problem. Back on SuSE-8.2 yacc was it's own package. I guess when yacc and bison were combined someone had the insight to still provide the original yacc package as byacc. I'm happy... Mark |