win10 安装 Flex 2.6 Bison 3.7

环境: Win10
网络: 科学上网 有助于 加速安装
背景:Bison 3 可以在yyparse中传递参数给 yyerror, 有助于主动通知错误。

方法 1

管理员模式打开 PowerShell

安装 choco

1
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

安装 winflexbison3

1
choco install winflexbison3

验证:

1
2
3
4
5
6
7
8
9
cd C:\ProgramData\chocolatey\lib\winflexbison3\tools

C:\ProgramData\chocolatey\lib\winflexbison3\tools> .\win_bison.exe --version
bison (GNU Bison) 3.7.4
Written by Robert Corbett and Richard Stallman.


C:\ProgramData\chocolatey\lib\winflexbison3\tools> .\win_flex.exe --version
win_flex.exe 2.6.4

方法 2

github 下载

1
2
github 下载编译好的文件
https://github.com/lexxmark/winflexbison/releases