WinFlexBison is a Windows port of Flex (the fast lexical analyser) and GNU Bison (parser generator). Both win_flex and win_bison are based on upstream sources but depend on system libraries only.
NOTE:
- 2.4.x versions include GNU Bison version 2.7
- 2.5.x versions include GNU Bison version 3.x.x
WinFlexBison bundles four upstream projects, and both shipped executables are combined works that include several of them:
- Flex — BSD license
(flex/src/COPYING,
shipped in the release package as
COPYING.flex) - GNU Bison — GPLv3+
(bison/src/COPYING,
shipped as
COPYING.bison) - GNU M4 — GPLv3+. Both tools run m4 over their skeletons; this port runs it in-process instead of as a child process, so M4 is linked into win_flex.exe as well as win_bison.exe
- gnulib — GPLv3+, a few files LGPL. Supplies the POSIX functions MSVC does not have, including the regular expression engine win_flex uses
Because GNU M4 and gnulib are linked into both executables, win_flex.exe and win_bison.exe are distributed under GPLv3+, even though flex's own sources are under a BSD license. Everything WinFlexBison itself adds — the Windows portability code, the build scripts, the custom build rules — is GPLv3+ too. See COPYING for the license text.
The scanners and parsers you generate with these tools are not covered by that. Flex's BSD license places no copyleft on generated scanners, and the Bison skeletons carry the special exception that lets you distribute a generated parser under terms of your choice; that exception is reproduced at the top of every parser win_bison writes.
All documentation, especially the images under custom_build_rules/docs, is distributed under the GNU Free Documentation License (FDL 1.3+). See COPYING.DOC.
https://github.com/lexxmark/winflexbison/releases provides stable versions. To test non-released development versions see the artifacts provided by CI.
The release page includes the full Changelog but you may also see the changelog.md file.
- Visual Studio 2017 or newer
- CMake 3.16 or newer
The AppVeyor badges above cover the 8 build jobs: VS2022 and VS2019, each x64 and
Win32, Release and Debug. Every one of them runs the Windows CTest gate — the
adapted flex suite, the bison compile-run and golden-diff tests, and our own
port-specific tests. The clang-cl badge is a GitHub Actions job that builds with
clang-cl (x64, Release and Debug) and runs the same gate. runtests.bat runs the same gate locally and needs nothing
beyond Visual Studio and CMake.
On top of that, a separate, non-gating CI job runs the full GNU Bison
Autotest suite — all 776 groups — against win_bison.exe through an MSYS2
shell. Latest status:
| groups | 776 |
| passing | 703 |
| expected failures (xfail) | 12, each with a documented cause |
| skipped | 61 (Java/D tiers, and cases needing filenames NTFS forbids) |
| unexpected failures | none |
It is deliberately non-gating: it reports on upstream bison behaviour, and its
xfail set can shift with the worker's locale and toolchain, so it is a signal to
read rather than a gate to trip. It appears in the
AppVeyor build as two
WFB_JOB=autotest cells, splitting the 776 groups by range so neither half runs
into AppVeyor's 60-minute per-job limit — AppVeyor badges are per project rather
than per job, so they have no badge of their own. See
tests/bison-autotest/README.md for how to run
it and what each xfail means.
You may use win_flex and win_bison directly on the command line or use them via CustomBuildRules in VisualStudio.