Published Flex Bison C++ Example 0.1
Posted on 2007-08-20 11:53 by Timo Bingmann at Permlink with 2 Comments. Tags: #flex-bison-cpp-example #c++ #code-example #parsing
Released example source code package Flex Bison C++ Example. The example source code is released into the public domain or, at your option, under the Do What The Fuck You Want To Public License (WTFPL).
This example shows how to use both Flex and Bison in C++ mode. This way both lexer and parser code and data is encapsulated into classes. Thus the lexer and parser are fully re-entrant, because all state variables are contained in the class objects. Furthermore multiple different lexer-parser pairs can easily be linked into one binary, because they have different class names and/or are located in a different namespace.
Why Use These Old Tools? Well, they are here to stay and they work well. But most important, the code generated by Flex and Bison requires no compile-time dependencies, because they generate fully autonomous source code. So far I have not found any modern parser generator which outputs independent code. It is even possible to compile the generated source on Windows with Visual C++ 2005.
For more information and the download package see the Flex Bison C++ Example web page.
I just wanted to say: thanks so much for publishing this. You've saved me a lot of time. Ta, Blair.