[vox-tech] Reg lex and flex compatibilty

Muthumeena M vox-tech@lists.lugod.org
Fri, 4 Jul 2003 12:37:15 +0530


Hi ,
Right now am porting an application which has few lex and yacc files from
solaris to linux.

The application has no problem in solaris whereas when i compile the same
in linux, it is getting stuck at the compilation of the file generated by
lexer i.e the lex.yy.c file

The lex output (lex.yy.c) are also quite different in solaris and linux.

The compilation errors are
1. In function `unsigned char input()':
`yysptr' undeclared (first use this  function). it goes on to many other
undeclared errors.

For this there were no variables declared in the file.l (lex input file).
Solaris had delared on its own, whereas in case of linux error was coming
in yy.c.
So i have manually declared in case of linux.
I do not know the reason why this incompatibility is there.


2. After the manual declaration of variables now it is giving
"previous declaration of int yywrap() with C++ linkage
conflicts with new declaration with C Linkage"
and many like this.

In makefile the options given are
@lex -t -l $< | sed s/"^yylex"/"int yylex"/g | sed s/yy/${*F}/g > $*.yy.c

and gcc of the .yy.c file.

I have tried including the -lfl option while compiling and -l option while
lexing.
But they were of no help.



                                                                                                             
                      Jeff Newmiller                                                                         
                      <jdnewmil@dcn.davis        To:       vox-tech@lists.lugod.org                          
                      .ca.us>                    cc:                                                         
                      Sent by:                   Subject:  Re: [vox-tech] Reg lex and flex compatibilty      
                      vox-tech-admin@list                                                                    
                      s.lugod.org                                                                            
                                                                                                             
                                                                                                             
                      07/04/2003 11:23 AM                                                                    
                      Please respond to                                                                      
                      vox-tech                                                                               
                                                                                                             
                                                                                                             




On Fri, 4 Jul 2003, Muthumeena M wrote:

> Hi,
>
> I have an input file for lex i.e a  file.l.
> In solaris, the lexer gives an output as file.yy.c  which is getting
> compiled without any compiler errors.
>
> Whereas when  i try the same in linux redhat 8.0,
> the lex command invokes flex 2.5  which also gives a file.yy.c as output.
> The problem comes in compiling this file.yy.c in linux.
> It gives many undeclared variable error.
>
> This could be bec of the incompatibilty bet lex and flex. Probably some
> make file option needs to be modified or added.
>
> Could anyone help me regarding this please?

Perhaps you don't have all of the headers and associated .c files that
contain the functions the author is calling?  It is also possible that
some flex translation options need to be set, but you would need to
provide a better description of the problem.. I haven't used lex in quite
awhile.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...2k
---------------------------------------------------------------------------


_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech