Re: Spirit X3 employee.cpp compile error

Larry Evans <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 08/31/2016 12:31 AM, Larry Evans wrote:
> On 08/20/2016 08:30 AM, Larry Evans wrote:
> [snip]
>
>> OOPS.  I should have re-looked at:
>>
>> https://github.com/boostorg/spirit/blob/develop/workbench/x3/toy/toy.cpp#L134
>>
>> which shows the rule_definition<>::parse function stores the
>> rule definition in the context dictionary.  Then, even
>> when BOOST_SPIRIT_DEFINE is not used, the rule rhs is looked up
>> by the rule<...>::parse function:
>>
>> https://github.com/boostorg/spirit/blob/develop/workbench/x3/toy/toy.cpp#L154
>>
>> The process is a little more complicated in the actual code.
>> There, rule_defintion<...>::parse:
>>
>> https://github.com/boostorg/spirit/blob/master/include/boost/spirit/home/x3/nonterminal/rule.hpp#L64
>>
>> *maybe* does something similar by putting the definition in the
>> context dictionary where the key is the rule ID.
> Yep, it's done here:
>
> https://github.com/boostorg/spirit/blob/master/include/boost/spirit/home/x3/nonterminal/detail/rule.hpp#L209
>
> in the expression:
>
>    make_rule_context<ID>(rhs, context, is_default_parse_rule())
>
> which, in case BOOST_SPIRIT_DEFINE is not used to define the rule,
> and the rule definition is not already in the context, calls:
>
> https://github.com/boostorg/spirit/blob/master/include/boost/spirit/home/x3/support/context.hpp#L89
>
> However, this only happens if rule_definition's on on the RHS of rules,
> as done here:
>
> http://coliru.stacked-crooked.com/a/41425cb30e49bc8a
>
> in lines 29-39 where process, node, and node_map are all rule_definition's.
>
> However, this use of rule_definitions on the RHS or rules suffers the
> same "crazy long mangled names" problem mentioned by Tongari here:
>
> http://boost.2283326.n4.nabble.com/compare-of-2-existing-methods-to-implement-grammar-recursion-tt4687574.html#a4687690


Another problem with this method is that mutually recursive rules
cannot be done for reasons mentioned in the //Result: comment of:

https://github.com/cppljevans/spirit/blob/trace-design/x3-design/employee_calc1_context_DEFINE.cpp

[snip]


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