Search code examples
flex-lexergnuwin32

When will a newer version of flex for windows be available?


I'm using flex (lexical analyzer, not Adobe Flex) on a project. However, I want to be able to compile on Windows platforms as well, but the Windows version's newest version is only 2.5.4a, so it won't compile my file for version 2.5.35. And no, I can't downgrade to the highest supported Windows version.

Anyone know about plans to upgrade the windows version, or have a suggestion to compile on windows anyway?


Solution

  • You can ask on the mailing list, or get involved in the Flex project yourself. I think the code-base for Flex has remained static for a while, but I don't know who maintains the Windows port. In the interim...

    I would recommend including the produced source in your project.

    1. Generate the lexer on a Linux system to produce your lex.c/lex.h files (or whatever)
    2. Include those files in your Win32 C source before you build

    If you don't have direct access to a Linux system, a virtual machine might be a good idea. The Flex source should be complaint to some C standard that builds on Windows, but most of the POSIX differences can be altered to use Win32 API fairly easily.

    Maybe distribute as:

    /src/source_files.c
    /src/lex.l
    /src/win32_lex/lex.c
    

    This way systems with a modern flex can generate the source from the lex file, and Windows systems compiling the source can use the complementary pre-processed C files.

    Short of using some user-space POSIX (Cygwin or whatever).

    A little bit of tweaking required, but isn't that portability for you!