My first contact with Bison and Flex goes back to 2004. When I first taught myself C++ language programming back in in 1990, I wished I could be able to create a programming language like C++ some day by myself. I have used C++ language after since 1990, and C++ language has been my only programming language. I never liked Java or any other programming language but C++.
From 2004 until 2008, I developed a complete scripting language called Yet Another Language using Bison and Flex. At that time I used Bison 2.54. After since 2008, I have not used Bison or Flex much... for I developed another kind of software that does not need scripting feature. Now I come back to numerical computing and need of these tools, Bison and Flex. Many things have changed since then. I have to read the manuals again.
Through this web space, I want to make a complete Bison and Flex tutorials with both easy-to-understand documentation and easy-to-follow YouTube videos. Note that English is not my mother tongue, and I learned it only through book reading such that my English pronunciation is horribly bad and hard to understand. However, I will do my best to delivery easy-to-follow YouTube videos along with detailed documentations that are not included in the official Bison and Flex manuals... Also I will unsparingly share my know-hows about scripting language development.
If you are using Bison and Flex for the first time in your life, installing Bison and Flex is rather challenging and even a bit frustrating. Some cool guy ported GNU Bison and Flex for Windows platform. Click here if you want to visit his website. As of this writing, Feb. 17, 2017, the latest version is win_flex_bison-2.5.9.zip. Please watch my YouTube video about installing win_flex_bison for use with Visual Studio. You need to download this package to install win_flex_bison to follow my tutorial video. Google chrome falsely alram about this download, if you are unsure, please verify your download using WinMD. You can also download my Powerpoint presentation about how to make settings in Visual Studio.
MD Code: 0b83403959ffdbe31905d1e7344a322b
(The Easy Way to Install Bison and Flex on Windows)
00B. Installing Bison and Flex - the Harder Way
As of Feb. 17, 2017, we will use Visual Studio 2015 with Update 3. You can create C++ programs using Visual Studio Community Edition, but I strongly recommend you to use Visual Studio Professional version or above. In my case, I use Visual Studio Enterprise. If you never installed Visual Studio by yourself before, please watch my YouTube video about How to Install Visual Studio 2015o . We will use Bison 3.0.4 and Flex 2.6.3. We need to install Cygwin to compile Bison and Flex by ourselves. Please watch How to Build, Install Bison, Flex, Cygwin on Windows. It might be might be challenging, but quite rewarding in the long run. You can download detailed manuscript for installation of Cygwin, bison, flex, and Powerpoint presentation.
(For Diehard Way to Install Bison and Flex on Windows)
If we successfully installed Bison and Flex on the machine, we can get started with our first Bison and Flex program. I will assume we are creating our program first time in our life using Bison and Flex. This step is most challenging, but also breathtakingly exciting and exhilarating. I would be greatly honored if you feel the same. Now watch this our first Bison & Flex video.
After watching this video, you may feel either "wow it's challenging but I will make it anyway" or "OMG, it's too difficult, I can't understand anything!" Don't get disheartened or discouraged yet! There is always easier ways. You will find it not that challenging if you keep watching my next video.
002. Three Different Ways to Install Bison and Flex
This video summarizes three different ways to install bison and flex on windows.
If you are learning Bison and Flex for the first time, I would recommend you to take the right course. After learning basics, delve into more advanced concept. Reentrant parser and lexer are very important if you succeed in software development in the long run. Download the sample code and watch the video below:
MD5 code: 83a0fa53b1ad0721cafacdc85b53954d
(Placeholder for video to come)
If you are diehard UNIX or LINUX developer and want to learn bison and flex on Windows platform, then this is the tutorial video for you, about how to install Bison and Flex included in MSYS2 package.
Please watch this video to learn how to use string buffer instead of file input.
Please watch this video to learn how to host Windows Form control in MFC Application.
MD5 code: 481fe4f6163d490a4199f3667929d2d4
Download sample source code I prepared before taping YouTube video
MD5 code: 9304572f2a4d94268d5c503a64af11cf
Download sample source code while taping YouTube video.
MD5 code: 0de8b5b59e6e6cc7d7eb5a2b59fc773f
Please watch this video to learn how to get flex input from ANSI text file.
Stack data structure is a must-have to implement a scripting language. Please watch this video to learn how to implement stack data structure.
This video explains how to pass parameters to yylex() and yyparse().
For more information, please this documents.
The primary cause of resource (or memory) leak in C++ programming is "exception unsafe" coding practice. If you write your codes in an exception-safe manner, you can reduce more than 60 to 70% of the dreadful resource leak in your C++ programs.
Download the sample source code.