Re: Horrible compiletimes and memory usage while compiling a parser with X3
Joel de Guzman <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 24/10/2016 3:43 PM, Mikael Asplund wrote: > When I ran into the template-depth problem I solved it using a "template firewall" > using custom parsers (very few) to solve small tricky common cases, like an identifier > parser (plus, I parse tokens, not characters, so I save some depth by the help of the > lexer and the custom basic token parser I use for everything). I also have a custom > parser for parsing a whole expression (that also cleans up the ast a bit before > returning it), so that my grammars that contain an expression doesn't add to the > template depth. The real "firewalling" comes, of course, from calling a non-template > function to do the parsing (notice the call to parse_expression in the templated > parser), like so: Mikael, this "template firewall" is the very purpose of BOOST_SPIRIT_DECLARE. See my other post. BOOST_SPIRIT_DECLARE gives you a template function declaration, nothing more, while BOOST_SPIRIT_DEFINE defines that template function. Regards, -- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/ ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi