Re: endless loop - crashing application

Larry Evans <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 08/22/2016 06:46 AM, Larry Evans wrote:
> On 08/22/2016 04:04 AM, Joel de Guzman wrote:
>> On 22/08/2016 1:09 PM, Jens Kallup wrote:
>>> Hello,
>>>
>>> QString, and QMessageBox are library functions from Qt.
>>> QString is the equalivant of std::string.
>>>
>>> I have change the source, so it should be compiled with
>>> STL.
>>> Thanks for helping
>>
>> Before anything else, have you tried BOOST_SPIRIT_DEBUG to
>> see a trace where the infinite recursion happens? I suspect
>> left recursive rules.
>>
>> Regards,
>>
> Hi Joel,
>
> I tried that; however, the problem I encountered was not at
> run-time (which I guess is what BOOST_SPIRIT_DEBUG helps with)
> but at compile_time where, with the code posted by Jens in his
> last email, results in errors about too many template instantiations:
>
> --{--cut here--
> yymain.email2016-08-22_0009.cc:525:32:   required from here
> /home/evansl/prog_dev/boost/releases/ro/boost_1_61_0/boost/core/enable_if.hpp:41:10:
> fatal error: template instantiation depth exceeds maximum of 100 (use
> -ftemplate-depth= to increase the maximum)
>     struct enable_if : public enable_if_c<Cond::value, T> {};
>            ^
> compilation terminated.
> --}-- cut here--
>
> Deciphering why this happening from the *huge* compiler error
> messages is daunting :(

Cutting out some of the rule definitions until there was just factor
avoided in 'excceeds maximum' error message.  IOW:

--{--cut here--
#define CUT_RULES 1
#if CUT_RULES
   #define CUT_EXPRESSION 1
   #if CUT_EXPRESSION
   #else
              expression =
                  factor                            [ _val  = qi::_1 ]
                  >> *(   ('+' >> factor            [ _val += qi::_1 ])
                      |   ('-' >> factor            [ _val -= qi::_1 ])
                      )
                  ;
   #endif //CUT_EXPRESSION
              factor =
                  tok.number_digit                [ _val = qi::_1 ]
                  |   ('-' >> factor              [ _val = neg(qi::_1)])
                  |   ('+' >> factor              [ _val = qi::_1 ] )
                  ;
#else
//as before
#endif //CUT_RULES
--}--cut here--

compiles, but with #define CUT_EXPRESSION 0, compilation fails with
the 'excceeds maximum' error message.

-regards,
Larry






------------------------------------------------------------------------------
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.