何时可以使用更新版本的flex for windows?

时间:2022-11-13 09:37:20

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.

我在项目中使用flex(词法分析器,而不是Adobe Flex)。但是,我希望能够在Windows平台上进行编译,但Windows版本的最新版本仅为2.5.4a,因此它不会为2.5.35版本编译我的文件。不,我不能降级到支持最高的Windows版本。

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

有人知道有关升级Windows版本的计划,或者有建议在Windows上编译吗?

2 个解决方案

#1


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...

您可以在邮件列表中询问,或亲自参与Flex项目。我认为Flex的代码库已经暂时保持静态,但我不知道是谁维护了Windows端口。在过渡期...

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. 在Linux系统上生成词法分析器以生成lex.c / lex.h文件(或其他)

  3. Include those files in your Win32 C source before you build
  4. 在构建之前将这些文件包含在Win32 C源代码中

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.

如果您无法直接访问Linux系统,则虚拟机可能是个好主意。 Flex源应该投诉构建在Windows上的某些C标准,但是大多数POSIX差异可以更改为相当容易地使用Win32 API。

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.

这样,具有现代flex的系统可以从lex文件生成源,并且编译源的Windows系统可以使用补充的预处理C文件。

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

没有使用一些用户空间POSIX(Cygwin或其他)。

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

需要进行一些调整,但对您而言不是那么便携!

#2


Windows builds of flex 2.5.35 do exist, but unfortunately they are not self contained. You can download the MINGW build here, and the Cygwin build here; see also another * question. Each build requires that its respective (MINGW or Cygwin) kernel be installed.

Flex 2.5.35的Windows版本确实存在,但不幸的是它们不是自包含的。你可以在这里下载MINGW构建,并在这里下载Cygwin构建;另见*问题。每个构建都需要安装其各自的(MINGW或Cygwin)内核。

#1


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...

您可以在邮件列表中询问,或亲自参与Flex项目。我认为Flex的代码库已经暂时保持静态,但我不知道是谁维护了Windows端口。在过渡期...

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. 在Linux系统上生成词法分析器以生成lex.c / lex.h文件(或其他)

  3. Include those files in your Win32 C source before you build
  4. 在构建之前将这些文件包含在Win32 C源代码中

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.

如果您无法直接访问Linux系统,则虚拟机可能是个好主意。 Flex源应该投诉构建在Windows上的某些C标准,但是大多数POSIX差异可以更改为相当容易地使用Win32 API。

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.

这样,具有现代flex的系统可以从lex文件生成源,并且编译源的Windows系统可以使用补充的预处理C文件。

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

没有使用一些用户空间POSIX(Cygwin或其他)。

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

需要进行一些调整,但对您而言不是那么便携!

#2


Windows builds of flex 2.5.35 do exist, but unfortunately they are not self contained. You can download the MINGW build here, and the Cygwin build here; see also another * question. Each build requires that its respective (MINGW or Cygwin) kernel be installed.

Flex 2.5.35的Windows版本确实存在,但不幸的是它们不是自包含的。你可以在这里下载MINGW构建,并在这里下载Cygwin构建;另见*问题。每个构建都需要安装其各自的(MINGW或Cygwin)内核。