Re: Spirit-X3 | Boost 1.59 | Compilation never finishes for a recursive grammar

cppljevans <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
Arun Muralidharan wrote
> Thanks a lot, Larry. I could compile it using the code from your branch. 
> So, the fix would be available now only in boost 1.65 ?
> 
> 
> Thanks.

On 04/22/2017 09:19 AM, Arun Muralidharan wrote:
> 
> Thanks a lot, Larry. I could compile it using the code from your branch. 
> So, the fix would be available now only in boost 1.65 ?

Glad to help, Arun.

However, I'm not in charge of making changes to spirit;
hence, Sehe would be the person to ask.  

I could issue a pull request for get_rhs; however, get_rhs
is somewhat experimental.  It has a patch for another spirit
problem with attribute transforms:

https://github.com/cppljevans/spirit/blob/get_rhs/include/boost/spirit/home/x3/nonterminal/detail/rule.hpp#L383

and I'm guessing that the official maintainers want to keep
patches focused on a single problem.  I'm not even real
certain the attribute transform patch is completely
correct.  That patch may solve one problem but cause another
:(  I need better understanding of how x3 handles attributes
before I'm comfortable with the attribute transform patch.

The problem your code highlighted was that of a particular
rule recursion implementation.  The purpose of the code
linked-to in my OP:

https://github.com/cppljevans/spirit/blob/get_rhs/include/boost/spirit/home/x3/nonterminal/detail/rule.hpp#L215

(i.e. the call to make_rule_context) was to implement rule
recursion by lookup of the rhs of a rule in the context.
Apparently that method works in some cases; however, in
other cases, in particular, the case of your code, it
results in, what I would guess, is infinite template
instantiation.

I could make another branch which only solves this
make_rule_context problem, if someone who is responsible for
making changes to spirit would think that's the way to go.
However, that's gonna break some code.  In particular:

https://github.com/boostorg/spirit/blob/master/test/x3/rule1.cpp

The solution for those breaking cases would be using the
BOOST_SPIRIT_DEFINE method for implementing rule recursion
instead of the make_rule_context method.  This one-method
for rule recursion position was advocated in the .txt file
attachment to:

 
http://boost.2283326.n4.nabble.com/x3-devel-why-2-methods-linking-rule-to-RHS-td4688021.html

However, that post got no interest.

So, there are pro's and con's to the patch, but, hopefully,
your code example may generate more interest in the
one-method rule recursion design.

Sorry I can't give a more definite answer :(

-Larry






--
View this message in context: http://boost.2283326.n4.nabble.com/Spirit-X3-Boost-1-59-Compilation-never-finishes-for-a-recursive-grammar-tp4693813p4693847.html
Sent from the spirit-general mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
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.