Bison and Flex in C++
I now understand why the Bison C++ example uses Flex in C stdio mode: because getting it to operate using C++ <iostream> is nigh-on impossible. Header files are reimported a few times and you need to juggle various #defines to produce something that'll work with a C++ stream.
You also have the problem that Flex's notion of namespaces and class prefix names are different to what Bison expects.
Here's one I did earlier. having got this to work (kind of), my plan is to never touch it again:
And the whole lot, if you're interested: example.tar.gz