Re: Design/structure X3 parser more like Qi parser
Sandro Pirkwieser <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <4A73F31802B9FB46A4428BA93C0A3DEB050330B98BC6@hermes.ith-icoserve.com> |
Hi, > I think this is the problem described here: > http://boost.2283326.n4.nabble.com/x3-devel-why-2-methods-linking-rule-to-RHS-tp4688021.html > which is another reason, besides the assumed compile time penalty, for using BOOST_SPIRIT_DEFINE. yes, it covers this topic, too (btw interesting post). In order to write such recursive parsers, in general one has to use BOOST_SPIRIT_DEFINE, yet by doing so the parser has to be defined in a namespace (at least with the current version of BOOST_SPIRIT_DEFINE). > I've updated the code to use an Ops template parameter to the calc1_gram::gram_deriv: > https://github.com/cppljevans/spirit/blob/ExagonLinkingError/workbench/x3/rule_defns/parse_rule_crtp.cpp#L160 > The Ops parameter shows how to change the character use for the arithmetic operators somewhat like the main_x3's make_csv_parser's fieldSep argument. > That method is not as "clean" as passing a runtime parameter thru the argument list, but it's close. Yeah, good idea. Seth did something for the CSV parser, too. > I failed to find documentation for the x3::with; hence, I couldn't try that. I even tried grepping the source code; however, all I found was names beginning with with_ but no x3::with. > That was with boost_1_61_0. Do you know where I could find examples or documentation of x3::with? Currently it's not contained in the documentation. I can offer you another example, my CSV parser in the X3 variant (main_x3.cpp), to be found as attachement in this previous mail: https://sourceforge.net/p/spirit/mailman/message/35546745/ Best regards, Sandro ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today.http://sdm.link/intel