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. Function Call Sequence
Once you succeed in generating parser.cpp using parser.y with Bison, and lexer.cpp using lexer.l with Flex, another big challenge awaiting you is to correctly understand how functions are called each other. Please download the tutorial files for this session.
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 conscept. 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: 256408adec1f914d7eece13417624b98
(Placeholder for video to come)
Download Flex Regular Expressions for Unicode Text
MD5: f410ff01cea6cb6a0b24cef7c5198110
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
asdf