Re: Horrible compiletimes and memory usage while compiling a parser with X3

Mikael Asplund <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Hi Joel,

Yes, I realize that. I'm not really familiar with the internals of the compilers, but it seemed to help my depth-needs...
maybe instantiation is deferred until link time and then everything triggers in a chain? I had so many problems with linking and depth at the same time trying to get my project to build correctly, that I may have overdone the firewalling more than necessary, but at least it works now.

Another upside of my "normal function firewall", though, is that you avoid some of the linking problems that X3 so easily run into when you split things up into multiple files, and are a right pain to try to debug. This is because all of a sudden there is no template functions as  APIs between files and so no subtle const difference or something can mess things up. This is the reason we're still on 1.60 (with a small const-patch from 1.61), since later version have link problems which are just too hard to debug.

  /Mikael

-----Original Message-----
From: Joel de Guzman [mailto:[email protected]] 
Sent: Sunday, November 6, 2016 18:09
To: [email protected]
Subject: Re: [Spirit-general] Horrible compiletimes and memory usage while compiling a parser with X3

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
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general

------------------------------------------------------------------------------
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.