Re: compare of 2 existing methods to implement grammar recursion

Larry Evans <[email protected]>
Newsgroups gmane.comp.parsers.spirit.general
Message-ID <[email protected]>
On 08/10/2016 08:36 AM, TONGARI J wrote:
> 2016-08-09 23:09 GMT+08:00 Larry Evans <[email protected]
> <mailto:[email protected]>>:
>
>     OOPS, apparently the idea of make_defns (which makes a mapping
>     from the rule to it's definition) had already been tried here:
>
>     https://gist.github.com/jamboree/11133291
>     <https://gist.github.com/jamboree/11133291>
>
>     where it's called rule_map.
>
>     However, the file given in that gist:
>
>     boost/spirit/home/x3/nonterminal/grammar.hpp
>
>     is not present here:
>
>     https://github.com/djowel/spirit_x3/tree/master/include/boost/spirit/home/x3/nonterminal
>     <https://github.com/djowel/spirit_x3/tree/master/include/boost/spirit/home/x3/nonterminal>
>
>     The history for this directory:
>
>     https://github.com/djowel/spirit_x3/commits/master/include/boost/spirit/home/x3/nonterminal
>     <https://github.com/djowel/spirit_x3/commits/master/include/boost/spirit/home/x3/nonterminal>
>
>     mentions nothing about grammar.hpp.
>
>     Would someone explain why this idea was not used?
>
>
> It was once used and finally replaced with what you see today. I can't
> recall the detail, but I remember that someone wrote a monster-sized
> grammar in one file and got some problem in compilation, for example,
> such a method will drive the linker very hard (especially in debug
> build) because it will result in crazy long mangled names for symbols,
> though some efforts were put into reducing the symbol size but the
> effects were not significant.

Ah!  That's what I suspected, as indicated by the comments starting here:

https://gist.github.com/cppljevans/3634cc4e8ad4da81531608e6aa847de5#file-rule_defns-cpp-L36

However, the default parse_rule code here:

https://github.com/djowel/spirit_x3/blob/master/include/boost/spirit/home/x3/nonterminal/rule.hpp#L34

still checks for a rule definition in the context argument.
If this method of implementing recursion by looking in the context is
no longer implemented, why is there still an attempt to find some sort
or rule_defintion in the context in this default parse_rule code?
I would think it should just fire the static_assert.

>
> Before long, the ADL trick was invented and evolves to what you see today.
>
>



------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. http://sdm.link/zohodev2dev
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.