9 Feb 23:46
Explicit Instantiation support
James H. Hill <hillj <at> cs.iupui.edu>
2010-02-09 22:46:04 GMT
2010-02-09 22:46:04 GMT
Hi, I am trying to compile a really large grammar (~110+ rules and counting). As expected, it takes forever to compile. But what is worse is that Visual Studio runs out of heap space and the compilation does not finish.(Continue reading)I am going to take a guess and say there is a memory leak somewhere in their preprocessor (or its not that optimized to handle the cool features of Boost.Spirit 2.0), but that is besides the point. So, I tried breaking the grammar to into many different files and compiling it. Unfortunately, I got the same results as before. I then realized that these are template and no matter how I break up the grammar, I will get the same results!! After scratching my head, I remember *explicit instantiation* and thought that would help me out. The plan was to break up the large grammar into smaller grammars, instantiate the grammars with the desire iterator type, and export it from an shared library. I thought this should work, however, there are compile errors when trying to do explicit instantiation. Below is my simple grammar (thanks to breaking it up, I can now include the example
): -------- namespace qi = ::boost::spirit::qi; namespace ascii = ::boost::spirit::ascii; template <typename IteratorT> class ident : public qi::grammar < IteratorT, std::string (),
I am going to take a guess and say there is a memory
leak somewhere in their preprocessor (or its not that optimized to
handle the cool features of Boost.Spirit 2.0), but that is besides the
point.
So, I tried breaking the grammar to into many different files and
compiling it. Unfortunately, I got the same results as before. I then
realized that these are template and no matter how I break up the
grammar, I will get the same results!!
After scratching my head, I remember *explicit instantiation* and
thought that would help me out. The plan was to break up the large
grammar into smaller grammars, instantiate the grammars with the
desire iterator type, and export it from an shared library. I thought
this should work, however, there are compile errors when trying to do
explicit instantiation. Below is my simple grammar (thanks to breaking
it up, I can now include the example
):
--------
namespace qi = ::boost::spirit::qi;
namespace ascii = ::boost::spirit::ascii;
template <typename IteratorT>
class ident : public qi::grammar < IteratorT,
std::string (),
RSS Feed