Re: Small grammar, long compilation time

Søren Enevoldsen <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 2017-10-30 16:05, Larry Evans wrote:
> On 10/30/2017 09:28 AM, Søren Enevoldsen wrote:
> [snip]
>> I submitted a pull request with some strings that should parse ok 
>> (they do here). 
> Thanks :)
>> I had to turn off BOOST_SPIRIT_X3_DEBUG in order to compile the code 
>> in the link you sent.
> That's strange.  I just compiled&ran without problem, and it showed
> the output of the debug trace, part of which is:

I think the debug flag not working might have been my fault. I noticed I 
was on develop in your fix-repo, and the pulls updated get_rhs, so I 
switched and I can compile with the debug #define enabled now. I no 
longer need: -DBOOST_SPIRIT_ATTR_XFORM_IN_RULE=0 
-DBOOST_SPIRIT_GET_RHS_CRTP=1 anymore.

> --{--cut here--
>> /home/evansl/dwnlds/llvm/5.0/prebuilt/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04/bin/clang++ 
>> -c -O0 -gdwarf-2 -stdlib=libc++  -std=c++1z 
>> -ftemplate-backtrace-limit=0 -fdiagnostics-show-template-tree 
>> -fno-elide-type -fmacro-backtrace-limit=0 
>> -I/home/evansl/prog_dev/boost/releases/ro/boost_1_65_1/sandbox/pull_requests/context_debug_fix.fork/spirit/include 
>> -I/home/evansl/prog_dev/boost/releases/ro/boost_1_65_1 
>> -I/home/evansl/prog_dev/boost/sandbox/lje/non_variadic_templates 
>> -DBOOST_SPIRIT_X3_EXPERIMENTAL_GET_RHS_NS=1 
>> -DBOOST_SPIRIT_X3_EXPERIMENTAL_GET_RHS_CRTP=0 
>> -DBOOST_SPIRIT_X3_EXPERIMENTAL_ATTR_XFORM_IN_RULE=1 
>> -ftemplate-depth=200  wccs_parser.cpp -MMD -o 
>> /tmp/build/clangxx5_0_pkg/boost/releases/ro/boost_1_65_1/sandbox/pull_requests/context_debug_fix.fork/spirit/workbench/x3/rec_ex_orig/wccs_parser.o 
>> /home/evansl/dwnlds/llvm/5.0/prebuilt/clang+llvm-5.0.0-linux-x86_64-ubuntu16.04/bin/clang++ 
>> -stdlib=libc++ 
>> /tmp/build/clangxx5_0_pkg/boost/releases/ro/boost_1_65_1/sandbox/pull_requests/context_debug_fix.fork/spirit/workbench/x3/rec_ex_orig/wccs_parser.o 
>> -o 
>> /tmp/build/clangxx5_0_pkg/boost/releases/ro/boost_1_65_1/sandbox/pull_requests/context_debug_fix.fork/spirit/workbench/x3/rec_ex_orig/wccs_parser.exe
>> /tmp/build/clangxx5_0_pkg/boost/releases/ro/boost_1_65_1/sandbox/pull_requests/context_debug_fix.fork/spirit/workbench/x3/rec_ex_orig/wccs_parser.exe 
>> <process>
>>   <try>0</try>
>>   <choice>
>>     <try>0</try>
>>     <composition>
>>       <try>0</try>
>>       <actionPrefix>
>>         <try>0</try>
>>         <N11wccs_parser22AstActionPrefixProcessE>
>>           <try>0</try>
>>           <N11wccs_parser9AstActionE>
>>             <try>0</try>
>>             <fail/>
>>           </N11wccs_parser9AstActionE>
>>           <fail/>
>>         </N11wccs_parser22AstActionPrefixProcessE>
>>         <renaming>
>>           <try>0</try>
>>           <restriction>
>>             <try>0</try>
>>             <primitive>
>>               <try>0</try>
>>               <N11wccs_parser14AstNullProcessE>
>>                 <try>0</try>
>>
>
> --}--cut here--
>
> Hence, I'm guessing I've not pushed on my local changes to the 
> remote.  I'll
> try to figure out what and correct.
> [snip]
>>
>> But just to be clear, it is compilation time that is the problem, not 
>> any particular input string. 
>
> I understand.  However, I wanted to see it actually run.  In addition,
> I wanted to see the changes I just made, worked. That's one reason for
> the #define BOOST_SPIRIT_X3_DEBUG.
>
>> I have been trying to simplify the case. Whenever I eliminate a rule 
>> in the "tower"/hierarchy of rules Process ::= choice and choice -> 
>> composition -> renaming -> restriction -> primitive, where we have 
>> the rule Process ::= choice again in parenthesis, the compilation 
>> time becomes practical again. I would assume such a hierarchy is not 
>> unusual for expressions. A naive guess is that it is somehow 
>> connected to the use of AstAnyProcess and the x3::forward_ast. But I 
>> have been unable to simplify the grammar without unexploding the 
>> compile time.
>
> Thanks for trying.  This make me suspect that this is an important test
> case because still, despite hours trying to understand and modify the
> code, I'm still don't understand it very well.  I suspect pinning down
> why this is happening my help me (and others) understand the code 
> better.  Of course 2 eyes on the problem is more helpful than just
> one; so, I hope you keep trying with me to understand the root cause
> of this problem.

My knowledge of Spirit is limited to that of an extremely recent user, 
and I do know really know how the template magic happens. But, I am 
certainly willing to help from my side, if able.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Spirit-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-general
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.