May 26, 2016 - Thomas Kim Bison & Flex on Windows using Visual Studio 2015, System Requirements - Windows Vista, 7, 8, 8.1, 10 - Visual Studio 2008, 2010, 2013, 2015 - 5 GB free disk space Tools: - Notepad++ https://notepad-plus-plus.org/ - 7zip http://www.7-zip.org/ IMPORTANT: Do not include blank space in the folder name or path string. 1. There are THREE (3) choices for Bison & Flex on Windows. Google search for "bison for windows" gives (a) Bison for Windows - GnuWin32 Version 2.4.1, year 2009 http://gnuwin32.sourceforge.net/packages/bison.htm (b) Win flex-bison download | SourceForge.net Version 2.7, year 2012 https://sourceforge.net/projects/winflexbison/ --------> (c) Our Choice for Bison & Flex - Bison - GNU Project - Free Software Foundation Version 3.0.4 - Jan 23, 2015 - Home - https://www.gnu.org/software/bison/ - Download - http://ftp.gnu.org/gnu/bison/ - ftp://ftp.gnu.org/gnu/bison/ - Flex - The Fast Lexical Analyzer Version 2.6.0, Nov. 10, 2015 - Home - http://flex.sourceforge.net/ - Download - https://sourceforge.net/projects/flex/ 2. We have to INSTALL Cygwin to use Bison & Flex on Windows - Cygwin Home http://www.cygwin.com/ - On 32-bit Windows, then install https://cygwin.com/setup-x86.exe ------> - On 64-bit Windows, then install https://cygwin.com/setup-x86_64.exe STEP 1. Create a folder DevSoft, either C:\DevSoft or ----------------> D:\DevSoft STEP2. Create TWO subfolders in DevSoft either C:\DevSoft\Cygwin C:\DevSoft\CygwinSetup or --------------------------> D:\DevSoft\Cygwin --------------------------> D:\DevSoft\CygwinSetup STEP 3. Download Cygwin either on 32-bit Windows, https://cygwin.com/setup-x86.exe or --------------------------> on 64-bit Windows, --------------------------> https://cygwin.com/setup-x86_64.exe in the folder either C:\DevSoft\CygwinSetup or --------------------------> D:\DevSoft\CygwinSetup STEP 4. Download Bison and Flex Bison - http://ftp.gnu.org/gnu/bison/bison-3.0.4.tar.gz bison-3.0.4.tar.gz Flex - https://sourceforge.net/projects/flex/files/latest/download?source=files flex-2.6.0.tar.bz2 STEP 5. Unzip bison-3.0.4.tar.gz and flex-2.6.0.tar.bz2 Copy to either C:\DevSoft\CygwinSetup or --------------------------> D:\DevSoft\CygwinSetup STEP 6. Double-click either setup-x86.exe or setup-x86_64.exe in the CygwinSetup folder STEP 7. Watch the video. Packages we need to install: gcc g++ bison flex make makepasswd help2man diffutils 3. Setup User's Home folder and Setup Environment Variables IMPORTANT: Do not include blank space in the folder name or path string. STEP 1. Setup User's Home folder mkpasswd -u "Thomas Kim" -l mkpasswd -u "Thomas Kim" -l > /etc/passwd /etc/passwd STEP 2. Open Cygwin/etc/passwd using notepad or vi and remove blank space in "Thomas Kim" as "ThomasKim" watch the video STEP3. Setup Environment Variable - path for D:\DevSoft\Cygwin\bin 4. Building Bison & Flex ./configure - make configuration for build make - build make clean - remove object files (.obj, .a or .o) make install - installs make uninstall - uninstalls either bison or flex - You can excute ./configure only once for each Bison and Flex - Before you run make you'd better run make clean to clean up .obj files - To build, you have to run make clean then make - To remove, build, and install again make uninstall make clean make make install STEP 1. Build Flex and Install In the \flex-2.6.0 folder ./configure make - make clean make changes to \flex-2.6.0\src\flex.skl #if defined(_MSC_BUILD) && (defined(_WIN32)||defined(_WIN64)) #include #include #else #include #endif in the same file #if defined(_MSC_BUILD) && (defined(_WIN32)||defined(_WIN64)) b->yy_is_interactive = file ? (_isatty( _fileno(file) ) > 0) : 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif \flex-2.6.0\src\main.c case OPT_VERSION: printf (_("%s %s - Minor fix by Thomas Kim\n"), program_name, flex_version); FLEX_EXIT (0); - make - make install STEP 2. Build Bison and Install - In the \bison-3.0.4 folder ./configure make - In the \bison-3.0.4 folder make clean - In the \bison-3.0.4\src\getargs.c file, make changes as printf (_("bison (GNU Bison) %s - Minor Fix by Thomas Kim"), VERSION); - In the \bison-3.0.4 folder make make install 5. Setup Environment Variables - path D:\DevSoft\Cygwin\usr\local\bin;D:\DevSoft\Cygwin\bin; Double-check bison and flex bison --version flex --version