You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(50) |
Jul
(179) |
Aug
(351) |
Sep
(351) |
Oct
(430) |
Nov
(244) |
Dec
(318) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(550) |
Feb
(527) |
Mar
(404) |
Apr
(314) |
May
(194) |
Jun
(128) |
Jul
(403) |
Aug
(476) |
Sep
(263) |
Oct
(458) |
Nov
(190) |
Dec
(288) |
| 2003 |
Jan
(248) |
Feb
(353) |
Mar
(409) |
Apr
(404) |
May
(207) |
Jun
(336) |
Jul
(314) |
Aug
(268) |
Sep
(296) |
Oct
(140) |
Nov
(224) |
Dec
(195) |
| 2004 |
Jan
(205) |
Feb
(400) |
Mar
(171) |
Apr
(178) |
May
(143) |
Jun
(119) |
Jul
(155) |
Aug
(254) |
Sep
(230) |
Oct
(154) |
Nov
(172) |
Dec
(138) |
| 2005 |
Jan
(200) |
Feb
(151) |
Mar
(154) |
Apr
(127) |
May
(69) |
Jun
(118) |
Jul
(195) |
Aug
(163) |
Sep
(161) |
Oct
(303) |
Nov
(100) |
Dec
(30) |
| 2006 |
Jan
(107) |
Feb
(95) |
Mar
(102) |
Apr
(133) |
May
(86) |
Jun
(55) |
Jul
(61) |
Aug
(59) |
Sep
(74) |
Oct
(115) |
Nov
(86) |
Dec
(92) |
| 2007 |
Jan
(106) |
Feb
(207) |
Mar
(67) |
Apr
(114) |
May
(115) |
Jun
(111) |
Jul
(156) |
Aug
(109) |
Sep
(196) |
Oct
(123) |
Nov
(130) |
Dec
(82) |
| 2008 |
Jan
(61) |
Feb
(80) |
Mar
(55) |
Apr
(144) |
May
(59) |
Jun
(69) |
Jul
(88) |
Aug
(107) |
Sep
(114) |
Oct
(163) |
Nov
(125) |
Dec
(326) |
| 2009 |
Jan
(293) |
Feb
(257) |
Mar
(183) |
Apr
(170) |
May
(323) |
Jun
(425) |
Jul
(336) |
Aug
(214) |
Sep
(426) |
Oct
(445) |
Nov
(380) |
Dec
(384) |
| 2010 |
Jan
(606) |
Feb
(412) |
Mar
(367) |
Apr
(275) |
May
(278) |
Jun
(295) |
Jul
(182) |
Aug
(135) |
Sep
(179) |
Oct
(266) |
Nov
(331) |
Dec
(313) |
| 2011 |
Jan
(199) |
Feb
(336) |
Mar
(275) |
Apr
(224) |
May
(297) |
Jun
(312) |
Jul
(194) |
Aug
(229) |
Sep
(196) |
Oct
(122) |
Nov
(98) |
Dec
(227) |
| 2012 |
Jan
(145) |
Feb
(83) |
Mar
(113) |
Apr
(52) |
May
(99) |
Jun
(51) |
Jul
(101) |
Aug
(93) |
Sep
(64) |
Oct
(48) |
Nov
(74) |
Dec
(52) |
| 2013 |
Jan
(75) |
Feb
(134) |
Mar
(63) |
Apr
(92) |
May
(134) |
Jun
(65) |
Jul
(65) |
Aug
(44) |
Sep
(59) |
Oct
(110) |
Nov
(23) |
Dec
(25) |
| 2014 |
Jan
(90) |
Feb
(77) |
Mar
(44) |
Apr
(213) |
May
(153) |
Jun
(63) |
Jul
(110) |
Aug
(44) |
Sep
(153) |
Oct
(45) |
Nov
(107) |
Dec
(12) |
| 2015 |
Jan
(7) |
Feb
(15) |
Mar
(37) |
Apr
(56) |
May
(127) |
Jun
(44) |
Jul
(18) |
Aug
(30) |
Sep
(11) |
Oct
(31) |
Nov
(15) |
Dec
(31) |
| 2016 |
Jan
(27) |
Feb
(30) |
Mar
(32) |
Apr
(18) |
May
(36) |
Jun
(14) |
Jul
(47) |
Aug
(81) |
Sep
(12) |
Oct
(52) |
Nov
(126) |
Dec
(51) |
| 2017 |
Jan
(19) |
Feb
(19) |
Mar
(34) |
Apr
(29) |
May
(17) |
Jun
(4) |
Jul
(28) |
Aug
(5) |
Sep
(17) |
Oct
(18) |
Nov
(37) |
Dec
(104) |
| 2018 |
Jan
(53) |
Feb
|
Mar
(12) |
Apr
(13) |
May
(12) |
Jun
(51) |
Jul
(20) |
Aug
(4) |
Sep
(8) |
Oct
(16) |
Nov
(35) |
Dec
(15) |
| 2019 |
Jan
(10) |
Feb
|
Mar
|
Apr
(2) |
May
(2) |
Jun
(9) |
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
(8) |
Dec
(2) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(1) |
Jun
|
Jul
(8) |
Aug
|
Sep
(5) |
Oct
(40) |
Nov
|
Dec
|
| 2021 |
Jan
(17) |
Feb
(4) |
Mar
|
Apr
|
May
(1) |
Jun
(4) |
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(8) |
Dec
(3) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(5) |
Oct
(2) |
Nov
|
Dec
|
| 2024 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(5) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(4) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Seth <bu...@se...> - 2025-01-10 03:31:44
|
On Thu, Jan 9, 2025, at 3:37 PM, Denis wrote: > I didn't attach an example because the question is more abstract. For > any grammar may exist an example with a huge input string for which > phrase_parse() will take a lot of time. Is it taken into account in Spirit? No. For roughly the same reason that it doesn't compute PI or defragment the heap. You can add that in many ways. For example you can put a `eps[timeout_action]` where `timeout_action` is a semantic action that fails when a time limit is exceeded. You might even make it throw so you can constructively deal with the error condition, either by catching the exception or Spirit's `on_error` feature, which enables you to preserve any partial parse results. Alternatively, you can build similar functionality into an iterator adaptor. This has the benefit of being re-usable in other contexts. Again, when your input can so large it's probably wise to check at the perimeters - **before** you do any work on it. Untrusted inputs are a common vector for security issues, which normally starts right with the allocations required. You want to prevent DoS attacks well before you start parsing. If your input is not large, but still the parsing can be exponentially heavy there's a problem with the grammar. > > El 09.01.2025 a las 16:50, Seth via Spirit-general escribió: >> Sure. C++ is a turing complete programming language. You can write whatever you need. >> >> If you have a specific question, please post the code, preferrably on stackoverflow.com. I'll see it there. >> >> Also, ask yourself why the grammar is slow. That's unusual. Unless, of course, the parsing isn't slow, but the input is just vast, in which case you could probably avoid starting parsing in the first place. >> >> Regards, >> Seth >> >> On Thu, Jan 9, 2025, at 11:04 AM, Denis wrote: >>> Hello. I have a complex grammar and phrase_parse() takes a lot of time. >>> Is there any option to interrupt its execution? >>> >>> >>> >>> _______________________________________________ >>> Spirit-general mailing list >>> Spi...@li... >>> https://lists.sourceforge.net/lists/listinfo/spirit-general >> >> _______________________________________________ >> Spirit-general mailing list >> Spi...@li... >> https://lists.sourceforge.net/lists/listinfo/spirit-general > > > > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general |
|
From: Denis <dgo...@gm...> - 2025-01-09 14:37:34
|
I didn't attach an example because the question is more abstract. For any grammar may exist an example with a huge input string for which phrase_parse() will take a lot of time. Is it taken into account in Spirit? El 09.01.2025 a las 16:50, Seth via Spirit-general escribió: > Sure. C++ is a turing complete programming language. You can write whatever you need. > > If you have a specific question, please post the code, preferrably on stackoverflow.com. I'll see it there. > > Also, ask yourself why the grammar is slow. That's unusual. Unless, of course, the parsing isn't slow, but the input is just vast, in which case you could probably avoid starting parsing in the first place. > > Regards, > Seth > > On Thu, Jan 9, 2025, at 11:04 AM, Denis wrote: >> Hello. I have a complex grammar and phrase_parse() takes a lot of time. >> Is there any option to interrupt its execution? >> >> >> >> _______________________________________________ >> Spirit-general mailing list >> Spi...@li... >> https://lists.sourceforge.net/lists/listinfo/spirit-general > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general |
|
From: Seth <bu...@se...> - 2025-01-09 14:06:20
|
Sure. C++ is a turing complete programming language. You can write whatever you need. If you have a specific question, please post the code, preferrably on stackoverflow.com. I'll see it there. Also, ask yourself why the grammar is slow. That's unusual. Unless, of course, the parsing isn't slow, but the input is just vast, in which case you could probably avoid starting parsing in the first place. Regards, Seth On Thu, Jan 9, 2025, at 11:04 AM, Denis wrote: > Hello. I have a complex grammar and phrase_parse() takes a lot of time. > Is there any option to interrupt its execution? > > > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general |
|
From: Denis <dgo...@gm...> - 2025-01-09 10:04:22
|
Hello. I have a complex grammar and phrase_parse() takes a lot of time. Is there any option to interrupt its execution? |
|
From: Michael P. <mwp...@gm...> - 2024-07-02 21:20:36
|
On Tue, Jul 2, 2024 at 5:12 PM Seth via Spirit-general < spi...@li...> wrote: > On Mon, Jul 1, 2024, at 4:48 PM, Michael Powell wrote: > > > On Sun, Jun 30, 2024 at 9:08 PM Richard <leg...@xm...> wrote: > > Are you aware of Boost.Parser? If I recall correctly, it was recently > accepted to boost and is considered (with blessings from Spirit devs) > as the successor to spirit: <https://github.com/tzlaine/parser> > > > Consider me aware now, appreciated. That looks interesting. Not aware of > the history at all, assuming it draws on Spirit expertise? X3? > > I don't think it draws on experience. It's a separate project from > scratch. It only borrows the expression-template conventions and perhaps > the *idea* of automatic attribute propagation. > > This may have pros (e.g. not requiring Boost Fusion and first-class Boost > PFR support, UTF8 by default?) and cons (not having quite the same > versatility/battle testing). > Sure, I mean, "I get it", I'm just asking the question. Being honest, it is not a successor (yet). It is in proposed stage, > correct? What's the status with that? Also, seems as though some of the > github badges (?). > > It is accepted, on conditions. The author will meet the conditions and > then it will be released in a future Boost Release. I know because I spent > hours some time ago scouring the Boost dev mailing list for this > information (why is it not on the site? God only knows). > https://lists.boost.org/Archives/boost/2024/03/256151.php > Of course, of course, fair enough. For me anyway, bare metal, until it is, it isn't. Not saying the criteria would not be met for it to fall out from proposal stages. Best of luck, thanks for clarifying. _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general > |
|
From: Seth <bu...@se...> - 2024-07-02 21:11:15
|
On Mon, Jul 1, 2024, at 4:48 PM, Michael Powell wrote: > > On Sun, Jun 30, 2024 at 9:08 PM Richard <leg...@xm...> wrote: >>> Are you aware of Boost.Parser? If I recall correctly, it was recently >>> accepted to boost and is considered (with blessings from Spirit devs) >>> as the successor to spirit: <https://github.com/tzlaine/parser> >> >> Consider me aware now, appreciated. That looks interesting. Not aware of the history at all, assuming it draws on Spirit expertise? X3? I don't think it draws on experience. It's a separate project from scratch. It only borrows the expression-template conventions and perhaps the *idea* of automatic attribute propagation. This may have pros (e.g. not requiring Boost Fusion and first-class Boost PFR support, UTF8 by default?) and cons (not having quite the same versatility/battle testing). > > Being honest, it is not a successor (yet). It is in proposed stage, correct? What's the status with that? Also, seems as though some of the github badges (?). It is accepted, on conditions. The author will meet the conditions and then it will be released in a future Boost Release. I know because I spent hours some time ago scouring the Boost dev mailing list for this information (why is it not on the site? God only knows). https://lists.boost.org/Archives/boost/2024/03/256151.php |
|
From: Michael P. <mwp...@gm...> - 2024-07-01 14:48:32
|
On Mon, Jul 1, 2024 at 10:42 AM Michael Powell <mwp...@gm...> wrote: > > > On Sun, Jun 30, 2024 at 9:08 PM Richard <leg...@xm...> wrote: > >> In article <CAM=aUXoTq6Om=+ >> Mtc...@ma...> you write: >> >It's been a minute since I last explored Boost, Spirit, v3, etc, and I >> have >> >a tiny project for which I am interested to consider Spirit, maybe v3, as >> >one possible solution. >> >> Are you aware of Boost.Parser? If I recall correctly, it was recently >> accepted to boost and is considered (with blessings from Spirit devs) >> as the successor to spirit: <https://github.com/tzlaine/parser> >> > > Consider me aware now, appreciated. That looks interesting. Not aware of > the history at all, assuming it draws on Spirit expertise? X3? > Being honest, it is not a successor (yet). It is in proposed stage, correct? What's the status with that? Also, seems as though some of the github badges (?). -- Richard >> >> -- >> "The Direct3D Graphics Pipeline" free book < >> http://tinyurl.com/d3d-pipeline> >> The Terminals Wiki <http://terminals-wiki.org> >> The Computer Graphics Museum <http://computergraphicsmuseum.org> >> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> >> >> >> _______________________________________________ >> Spirit-general mailing list >> Spi...@li... >> https://lists.sourceforge.net/lists/listinfo/spirit-general >> > |
|
From: Michael P. <mwp...@gm...> - 2024-07-01 14:43:08
|
On Sun, Jun 30, 2024 at 9:08 PM Richard <leg...@xm...> wrote: > In article <CAM=aUXoTq6Om=+ > Mtc...@ma...> you write: > >It's been a minute since I last explored Boost, Spirit, v3, etc, and I > have > >a tiny project for which I am interested to consider Spirit, maybe v3, as > >one possible solution. > > Are you aware of Boost.Parser? If I recall correctly, it was recently > accepted to boost and is considered (with blessings from Spirit devs) > as the successor to spirit: <https://github.com/tzlaine/parser> > Consider me aware now, appreciated. That looks interesting. Not aware of the history at all, assuming it draws on Spirit expertise? X3? -- Richard > > -- > "The Direct3D Graphics Pipeline" free book < > http://tinyurl.com/d3d-pipeline> > The Terminals Wiki <http://terminals-wiki.org> > The Computer Graphics Museum <http://computergraphicsmuseum.org> > Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> > > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general > |
|
From: Richard <leg...@xm...> - 2024-07-01 01:07:02
|
In article <CAM...@ma...> you write: >It's been a minute since I last explored Boost, Spirit, v3, etc, and I have >a tiny project for which I am interested to consider Spirit, maybe v3, as >one possible solution. Are you aware of Boost.Parser? If I recall correctly, it was recently accepted to boost and is considered (with blessings from Spirit devs) as the successor to spirit: <https://github.com/tzlaine/parser> -- Richard -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
|
From: Seth <bu...@se...> - 2024-07-01 00:13:51
|
On Sat, Jun 29, 2024, at 7:45 PM, Michael Powell wrote: >> Huh, nice, very interesting. The key is the boost::multiprecision::cpp_dec_float_50 coordinate value, I suppose. Everything else being punctuation, arrangement, etc. >> >> How about for semantic actions? Are they still supported? For instance, when I encounter a production, attribute, synthesis, I'd like to raise that as a signal, for instance, that a listener subscribing to the parser may subscribe and follow, respond, otherwise populate the DSL. > > Need a bit of guidance where SA are concerned. > With all due respect, I think you're making things unnecessarily complicated by focusing on SA's from the get go. I'd focus on the functional requirements first and foremost. If you insist on an event-based parser you might be better off just using `int_parser` directly without even bothering about the rule machinery, since IMHO Spirit's non-terminal parsers shine _without_ semantic actions ¹ ¹ https://stackoverflow.com/questions/8259440/boost-spirit-semantic-actions-are-evil > If I have a rule that wants to synthesize an enumerated value, let's say, and the RHS was an alternatives of chars (below), how do I do that, what goes in the SA, and where? I'd do this: https://coliru.stacked-crooked.com/a/93d68b17f9f11662 #include <boost/spirit/home/x3.hpp> #include <iostream> enum class Foo { bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud }; static inline std::ostream& operator<<(std::ostream& os, Foo f) { switch (f) { case Foo::bar: return os << "bar"; case Foo::baz: return os << "baz"; case Foo::qux: return os << "qux"; case Foo::quux: return os << "quux"; case Foo::corge: return os << "corge"; case Foo::grault: return os << "grault"; case Foo::garply: return os << "garply"; case Foo::waldo: return os << "waldo"; case Foo::fred: return os << "fred"; case Foo::plugh: return os << "plugh"; case Foo::xyzzy: return os << "xyzzy"; case Foo::thud: return os << "thud"; default: return os << "???"; } } namespace x3 = boost::spirit::x3; x3::symbols<Foo> const foo = { { "bar", Foo::bar }, { "baz", Foo::baz }, { "qux", Foo::qux }, { "quux", Foo::quux }, { "corge", Foo::corge }, { "grault", Foo::grault }, { "garply", Foo::garply }, { "waldo", Foo::waldo }, { "fred", Foo::fred }, { "plugh", Foo::plugh }, { "xyzzy", Foo::xyzzy }, { "thud", Foo::thud } }; int main() { std::string_view input = "bar, baz, QuX, QuUx, CoRgE, gRAULT, GARPLY,\n" "WALDO, fred, plugh, xyzzy, thud"; std::vector<Foo> result; if (phrase_parse(input.begin(), input.end(), x3::no_case[foo] % ',', x3::space, result)) for (auto f : result) std::cout << static_cast<int>(f) << "(" << f << ")" << std::endl; else std::cout << "Parsing failed\n"; } > Another thing I might like to do is trigger a signal from said SA, if that is possible to do, which I am assuming it is. Correct. E.g. in Qi: https://coliru.stacked-crooked.com/a/a862c00ef67851c0 #include <boost/fusion/adapted/std_tuple.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/phoenix.hpp> #include <boost/signals2.hpp> #include <boost/spirit/include/qi.hpp> #include <fmt/ostream.h> #include <fmt/ranges.h> #include <fmt/std.h> enum class Foo { bar, baz, qux, quux, corge, grault, garply, waldo, fred, plugh, xyzzy, thud }; static inline std::ostream& operator<<(std::ostream& os, Foo f) { switch (f) { case Foo::bar: return os << "bar"; case Foo::baz: return os << "baz"; case Foo::qux: return os << "qux"; case Foo::quux: return os << "quux"; case Foo::corge: return os << "corge"; case Foo::grault: return os << "grault"; case Foo::garply: return os << "garply"; case Foo::waldo: return os << "waldo"; case Foo::fred: return os << "fred"; case Foo::plugh: return os << "plugh"; case Foo::xyzzy: return os << "xyzzy"; case Foo::thud: return os << "thud"; default: return os << "???"; } } using Num = boost::multiprecision::cpp_dec_float_50; using Coord = std::tuple<Num, Num, Num>; template <> struct fmt::formatter<Foo> : ostream_formatter {}; template <> struct fmt::formatter<Num> : ostream_formatter {}; using Token = std::variant<Foo, Num>; using Tokens = std::vector<Token>; namespace qi = boost::spirit::qi; struct FooParser : qi::symbols<char, Foo> { FooParser() { add("bar", Foo::bar)("baz", Foo::baz)("qux", Foo::qux)("quux", Foo::quux)("corge", Foo::corge)( "grault", Foo::grault)("garply", Foo::garply)("waldo", Foo::waldo)("fred", Foo::fred)( "plugh", Foo::plugh)("xyzzy", Foo::xyzzy)("thud", Foo::thud); } } const foo; namespace qi = boost::spirit::qi; template <typename It> struct ParseTokens : qi::grammar<It, std::vector<Token>()> { ParseTokens() : ParseTokens::base_type(start) { boost::phoenix::function on_foo_ { [this](Foo f) { on_foo(f); } }; boost::phoenix::function on_num_ { [this](Num n) { on_number(n); } }; using namespace qi::labels; start %= qi::skip(qi::space)[ // *(num_[on_num_(_1)] | qi::no_case[foo_][on_foo_(_1)]) // ]; } boost::signals2::signal<void(Num num)> on_number; boost::signals2::signal<void(Foo foo)> on_foo; private: qi::rule<It, std::vector<Token>()> start; FooParser foo_; qi::real_parser<Num> num_; }; int main() { ParseTokens<std::string_view::const_iterator> file_; file_.on_foo.connect([](Foo f) { fmt::print("Event Foo: {}\n", f); }); std::string_view input = R"(1.1 2.2 QuX 2. 3. 1 2 3 -1.1 -2.2 -3.3 -.1 -.2 -.3 -1. -2. -3. xyzzy .3e3 1.e1 2.e2 3.e3 1e1 COrGe 2e2 3e3 1.e1 waldo 2.e2 3.e3)"; std::vector<Token> coords; if (parse(begin(input), end(input), file_, coords)) fmt::print("Parsed:\n {}\n", coords); else fmt::print("Failed to parse\n"); } Printing Event Foo: qux Event Foo: xyzzy Event Foo: corge Event Foo: waldo Parsed: [variant(1.1), variant(2.2), variant(qux), variant(2), variant(3), variant(1), variant(2), variant(3), variant(-1.1), variant(-2.2), variant(-3.3), variant(-0.1), variant(-0.2), variant(-0.3), variant(-1), variant(-2), variant(-3), variant(xyzzy), variant(300), variant(10), variant(200), variant(3000), variant(10), variant(corge), variant(200), variant(3000), variant(10), variant(waldo), variant(200), variant(3000)] > That for abstractions like a listener component can then respond with appropriate user space call backs, possibly involving context, probably also the synthesized attribute, and so on. The precise shape and arguments of said callbacks, tentative until I get my arms around the X3 SA mechanism. In X3 everything is potentially simpler - at least for the compiler: https://coliru.stacked-crooked.com/a/57671f7c64b7d768 I suspect an X/Y problem hiding in the focus on SA. You can always just write some code and then ask when you get stuck, instead of painting air castles and assuming solutions ahead of time. Of course, planning is half the job, but it helps to know the tools and limitations if you do. |
|
From: Michael P. <mwp...@gm...> - 2024-06-29 17:46:15
|
On Fri, Jun 28, 2024 at 8:09 PM Michael Powell <mwp...@gm...> wrote: > > > On Fri, Jun 28, 2024 at 7:18 PM Seth via Spirit-general < > spi...@li...> wrote: > >> On Fri, Jun 28, 2024, at 5:56 PM, Michael Powell wrote: >> >> Hello, >> >> [...] negative versions should also be supported: "1.2", ".2", "1.", "1". >> >> This is very key, although C++ float is probably my only choice there, I >> do not know. Precision is an absolute must, floating point precision issues >> cannot be tolerated. >> >> > Huh, nice, very interesting. The key is > the boost::multiprecision::cpp_dec_float_50 coordinate value, I suppose. > Everything else being punctuation, arrangement, etc. > > How about for semantic actions? Are they still supported? For instance, > when I encounter a production, attribute, synthesis, I'd like to raise that > as a signal, for instance, that a listener subscribing to the parser may > subscribe and follow, respond, otherwise populate the DSL. > Need a bit of guidance where SA are concerned. If I have a rule that wants to synthesize an enumerated value, let's say, and the RHS was an alternatives of chars (below), how do I do that, what goes in the SA, and where? https://www.boost.org/doc/libs/1_85_0/libs/spirit/doc/x3/html/spirit_x3/quick_reference/semantic_actions.html I'm not sure this is very instructive: Has the form: p[f] where f is a function with the signatures: void f(Context&); Not least of all being, I'm not sure I see a way to synthesize the desired value (or type) that I want, other side of Context. Another case might be from that decimal float value, and or axis enum, std:tuple<axis_type, float> or float, depending on the Coordinate rule, to coordinate instance. Another thing I might like to do is trigger a signal from said SA, if that is possible to do, which I am assuming it is. That for abstractions like a listener component can then respond with appropriate user space call backs, possibly involving context, probably also the synthesized attribute, and so on. The precise shape and arguments of said callbacks, tentative until I get my arms around the X3 SA mechanism. For instance, with a minor adjustment, allowing for 3+, in our input and > not flat rejecting for 4+. Listeners may respond with an index sensitive > treatment, for example. > > auto coord_ = num_; > auto loc_ = coord_+; > > Or in the case of an axis coordinate rule, pseudo code something like this: > > auto axis_ = char_('x') | char_('y') | char_('z'); > auto axis_coord_ = axis_ >> '=' << num_ > auto axis_loc_ = axis_coord_+; > > Listeners in the case of an axis approach can receive any number of axis > based coordinate assignments. The last of which wins, defaults (to the > listener) always being zed. > > Along these lines. > > The key to which raising signals at each of the rule productions, if > possible. > > The decimal being "very key" are no issue at all. Here's demo using >> decimal floats and all the input formats you specified and then some: >> https://coliru.stacked-crooked.com/a/8aef2c571995464b >> > > >> #include <boost/fusion/adapted/std_tuple.hpp> >> #include <boost/multiprecision/cpp_dec_float.hpp> >> #include <boost/spirit/home/x3.hpp> >> #include <fmt/ostream.h> >> #include <fmt/ranges.h> >> #include <fmt/std.h> >> >> using Num = boost::multiprecision::cpp_dec_float_50; >> using Coord = std::tuple<Num, Num, Num>; >> template <> struct fmt::formatter<Num> : ostream_formatter {}; >> >> int main() { >> namespace x3 = boost::spirit::x3; >> auto num_ = x3::real_parser<Num>{}; >> auto coord_ = num_ >> num_ >> num_; >> auto file_ = x3::skip(x3::blank)[coord_ % x3::eol]; >> >> for (std::string_view input : { >> R"(1.1 2.2 3.3 >> .1 .2 .3 >> 1. 2. 3. >> 1 2 3)", >> R"(-1.1 -2.2 -3.3 >> -.1 -.2 -.3 >> -1. -2. -3. >> -1 -2 -3)", >> R"(1.1e1 2.2e2 3.3e3 >> .1e1 .2e2 .3e3 >> 1.e1 2.e2 3.e3 >> 1e1 2e2 3e3)", >> R"(1.1e-1 2.2e-2 3.3e-3 >> .1e-1 .2e-2 .3e-3 >> 1.e-1 2.e-2 3.e-3 >> 1e-1 2e-2 3e-3)", >> R"(inf -inf nan)", >> }) { >> >> std::vector<Coord> coords; >> if (parse(begin(input), end(input), file_, coords)) >> fmt::print("Parsed:\n - {}\n", fmt::join(coords, "\n - ")); >> else >> fmt::print("Failed to parse\n"); >> } >> } >> >> This prints (live on coliru as well): >> >> Parsed: >> >> - (1.1, 2.2, 3.3) >> >> - (0.1, 0.2, 0.3) >> >> - (1, 2, 3) >> >> - (1, 2, 3) >> >> Parsed: >> >> - (-1.1, -2.2, -3.3) >> >> - (-0.1, -0.2, -0.3) >> >> - (-1, -2, -3) >> >> - (-1, -2, -3) >> >> Parsed: >> >> - (11, 220, 3300) >> >> - (1, 20, 300) >> >> - (10, 200, 3000) >> >> - (10, 200, 3000) >> >> Parsed: >> >> - (0.11, 0.022, 0.0033) >> >> - (0.01, 0.002, 0.0003) >> >> - (0.1, 0.02, 0.003) >> >> - (0.1, 0.02, 0.003) >> >> Parsed: >> >> - (inf, -inf, nan) >> >> >> In summary, might Spirit, either v2 or v3, possibly work there? I do not >> expect the rules, synthesis, etc, to be that complex. It will be trickier, >> perhaps, to message a listener from the parser, but not insurmountable, I >> think. >> >> Thoughts? >> >> Note that X3 is not yet interface stable, so you might want to prefer Qi: >> https://coliru.stacked-crooked.com/a/1bdbbc130ffba345 >> >> Please don't use SWIG unless you are wrapping an API for use in other >> languages like Python or Matlab. >> >> Regards, Seth >> >> _______________________________________________ >> Spirit-general mailing list >> Spi...@li... >> https://lists.sourceforge.net/lists/listinfo/spirit-general >> > |
|
From: Michael P. <mwp...@gm...> - 2024-06-29 00:16:17
|
On Fri, Jun 28, 2024 at 7:18 PM Seth via Spirit-general < spi...@li...> wrote: > On Fri, Jun 28, 2024, at 5:56 PM, Michael Powell wrote: > > Hello, > > [...] negative versions should also be supported: "1.2", ".2", "1.", "1". > > This is very key, although C++ float is probably my only choice there, I > do not know. Precision is an absolute must, floating point precision issues > cannot be tolerated. > > > The decimal being "very key" are no issue at all. Here's demo using > decimal floats and all the input formats you specified and then some: > https://coliru.stacked-crooked.com/a/8aef2c571995464b > > #include <boost/fusion/adapted/std_tuple.hpp> > #include <boost/multiprecision/cpp_dec_float.hpp> > #include <boost/spirit/home/x3.hpp> > #include <fmt/ostream.h> > #include <fmt/ranges.h> > #include <fmt/std.h> > > using Num = boost::multiprecision::cpp_dec_float_50; > using Coord = std::tuple<Num, Num, Num>; > template <> struct fmt::formatter<Num> : ostream_formatter {}; > > int main() { > namespace x3 = boost::spirit::x3; > auto num_ = x3::real_parser<Num>{}; > auto coord_ = num_ >> num_ >> num_; > auto file_ = x3::skip(x3::blank)[coord_ % x3::eol]; > > for (std::string_view input : { > R"(1.1 2.2 3.3 > .1 .2 .3 > 1. 2. 3. > 1 2 3)", > R"(-1.1 -2.2 -3.3 > -.1 -.2 -.3 > -1. -2. -3. > -1 -2 -3)", > R"(1.1e1 2.2e2 3.3e3 > .1e1 .2e2 .3e3 > 1.e1 2.e2 3.e3 > 1e1 2e2 3e3)", > R"(1.1e-1 2.2e-2 3.3e-3 > .1e-1 .2e-2 .3e-3 > 1.e-1 2.e-2 3.e-3 > 1e-1 2e-2 3e-3)", > R"(inf -inf nan)", > }) { > > std::vector<Coord> coords; > if (parse(begin(input), end(input), file_, coords)) > fmt::print("Parsed:\n - {}\n", fmt::join(coords, "\n - ")); > else > fmt::print("Failed to parse\n"); > } > } > > This prints (live on coliru as well): > > Parsed: > > - (1.1, 2.2, 3.3) > > - (0.1, 0.2, 0.3) > > - (1, 2, 3) > > - (1, 2, 3) > > Parsed: > > - (-1.1, -2.2, -3.3) > > - (-0.1, -0.2, -0.3) > > - (-1, -2, -3) > > - (-1, -2, -3) > > Parsed: > > - (11, 220, 3300) > > - (1, 20, 300) > > - (10, 200, 3000) > > - (10, 200, 3000) > > Parsed: > > - (0.11, 0.022, 0.0033) > > - (0.01, 0.002, 0.0003) > > - (0.1, 0.02, 0.003) > > - (0.1, 0.02, 0.003) > > Parsed: > > - (inf, -inf, nan) > > > In summary, might Spirit, either v2 or v3, possibly work there? I do not > expect the rules, synthesis, etc, to be that complex. It will be trickier, > perhaps, to message a listener from the parser, but not insurmountable, I > think. > > Thoughts? > > Note that X3 is not yet interface stable, so you might want to prefer Qi: > https://coliru.stacked-crooked.com/a/1bdbbc130ffba345 > > Please don't use SWIG unless you are wrapping an API for use in other > languages like Python or Matlab. > I'm not sure what "interface stable" means; the "X" presumably still short for "experimental" side of experimental. Which is fair; although how long has it been experimental? Only Qi analogs, thus far; still no Karma? Did the project run out of funding somewhere along the way? Just curious, do not need to elaborate. I do not think of Spirit anything, Qi, X, etc, being more than internally facing implementation details. However, top level "parser" abstractions, listeners (i.e. to internally triggered signals), 1000 pct. Or at least that's the intended goal, and consume via dotnet runtime. Regards, Seth > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general > |
|
From: Michael P. <mwp...@gm...> - 2024-06-29 00:09:30
|
On Fri, Jun 28, 2024 at 7:18 PM Seth via Spirit-general <
spi...@li...> wrote:
> On Fri, Jun 28, 2024, at 5:56 PM, Michael Powell wrote:
>
> Hello,
>
> [...] negative versions should also be supported: "1.2", ".2", "1.", "1".
>
> This is very key, although C++ float is probably my only choice there, I
> do not know. Precision is an absolute must, floating point precision issues
> cannot be tolerated.
>
>
Huh, nice, very interesting. The key is
the boost::multiprecision::cpp_dec_float_50 coordinate value, I suppose.
Everything else being punctuation, arrangement, etc.
How about for semantic actions? Are they still supported? For instance,
when I encounter a production, attribute, synthesis, I'd like to raise that
as a signal, for instance, that a listener subscribing to the parser may
subscribe and follow, respond, otherwise populate the DSL.
For instance, with a minor adjustment, allowing for 3+, in our input and
not flat rejecting for 4+. Listeners may respond with an index sensitive
treatment, for example.
auto coord_ = num_;
auto loc_ = coord_+;
Or in the case of an axis coordinate rule, pseudo code something like this:
auto axis_ = char_('x') | char_('y') | char_('z');
auto axis_coord_ = axis_ >> '=' << num_
auto axis_loc_ = axis_coord_+;
Listeners in the case of an axis approach can receive any number of axis
based coordinate assignments. The last of which wins, defaults (to the
listener) always being zed.
Along these lines.
The key to which raising signals at each of the rule productions, if
possible.
The decimal being "very key" are no issue at all. Here's demo using decimal
> floats and all the input formats you specified and then some:
> https://coliru.stacked-crooked.com/a/8aef2c571995464b
>
> #include <boost/fusion/adapted/std_tuple.hpp>
> #include <boost/multiprecision/cpp_dec_float.hpp>
> #include <boost/spirit/home/x3.hpp>
> #include <fmt/ostream.h>
> #include <fmt/ranges.h>
> #include <fmt/std.h>
>
> using Num = boost::multiprecision::cpp_dec_float_50;
> using Coord = std::tuple<Num, Num, Num>;
> template <> struct fmt::formatter<Num> : ostream_formatter {};
>
> int main() {
> namespace x3 = boost::spirit::x3;
> auto num_ = x3::real_parser<Num>{};
> auto coord_ = num_ >> num_ >> num_;
> auto file_ = x3::skip(x3::blank)[coord_ % x3::eol];
>
> for (std::string_view input : {
> R"(1.1 2.2 3.3
> .1 .2 .3
> 1. 2. 3.
> 1 2 3)",
> R"(-1.1 -2.2 -3.3
> -.1 -.2 -.3
> -1. -2. -3.
> -1 -2 -3)",
> R"(1.1e1 2.2e2 3.3e3
> .1e1 .2e2 .3e3
> 1.e1 2.e2 3.e3
> 1e1 2e2 3e3)",
> R"(1.1e-1 2.2e-2 3.3e-3
> .1e-1 .2e-2 .3e-3
> 1.e-1 2.e-2 3.e-3
> 1e-1 2e-2 3e-3)",
> R"(inf -inf nan)",
> }) {
>
> std::vector<Coord> coords;
> if (parse(begin(input), end(input), file_, coords))
> fmt::print("Parsed:\n - {}\n", fmt::join(coords, "\n - "));
> else
> fmt::print("Failed to parse\n");
> }
> }
>
> This prints (live on coliru as well):
>
> Parsed:
>
> - (1.1, 2.2, 3.3)
>
> - (0.1, 0.2, 0.3)
>
> - (1, 2, 3)
>
> - (1, 2, 3)
>
> Parsed:
>
> - (-1.1, -2.2, -3.3)
>
> - (-0.1, -0.2, -0.3)
>
> - (-1, -2, -3)
>
> - (-1, -2, -3)
>
> Parsed:
>
> - (11, 220, 3300)
>
> - (1, 20, 300)
>
> - (10, 200, 3000)
>
> - (10, 200, 3000)
>
> Parsed:
>
> - (0.11, 0.022, 0.0033)
>
> - (0.01, 0.002, 0.0003)
>
> - (0.1, 0.02, 0.003)
>
> - (0.1, 0.02, 0.003)
>
> Parsed:
>
> - (inf, -inf, nan)
>
>
> In summary, might Spirit, either v2 or v3, possibly work there? I do not
> expect the rules, synthesis, etc, to be that complex. It will be trickier,
> perhaps, to message a listener from the parser, but not insurmountable, I
> think.
>
> Thoughts?
>
> Note that X3 is not yet interface stable, so you might want to prefer Qi:
> https://coliru.stacked-crooked.com/a/1bdbbc130ffba345
>
> Please don't use SWIG unless you are wrapping an API for use in other
> languages like Python or Matlab.
>
> Regards, Seth
>
> _______________________________________________
> Spirit-general mailing list
> Spi...@li...
> https://lists.sourceforge.net/lists/listinfo/spirit-general
>
|
|
From: Seth <bu...@se...> - 2024-06-28 23:16:10
|
On Fri, Jun 28, 2024, at 5:56 PM, Michael Powell wrote: > Hello, > > [...] negative versions should also be supported: "1.2", ".2", "1.", "1". > > This is very key, although C++ float is probably my only choice there, I do not know. Precision is an absolute must, floating point precision issues cannot be tolerated. The decimal being "very key" are no issue at all. Here's demo using decimal floats and all the input formats you specified and then some: https://coliru.stacked-crooked.com/a/8aef2c571995464b #include <boost/fusion/adapted/std_tuple.hpp> #include <boost/multiprecision/cpp_dec_float.hpp> #include <boost/spirit/home/x3.hpp> #include <fmt/ostream.h> #include <fmt/ranges.h> #include <fmt/std.h> using Num = boost::multiprecision::cpp_dec_float_50; using Coord = std::tuple<Num, Num, Num>; template <> struct fmt::formatter<Num> : ostream_formatter {}; int main() { namespace x3 = boost::spirit::x3; auto num_ = x3::real_parser<Num>{}; auto coord_ = num_ >> num_ >> num_; auto file_ = x3::skip(x3::blank)[coord_ % x3::eol]; for (std::string_view input : { R"(1.1 2.2 3.3 .1 .2 .3 1. 2. 3. 1 2 3)", R"(-1.1 -2.2 -3.3 -.1 -.2 -.3 -1. -2. -3. -1 -2 -3)", R"(1.1e1 2.2e2 3.3e3 .1e1 .2e2 .3e3 1.e1 2.e2 3.e3 1e1 2e2 3e3)", R"(1.1e-1 2.2e-2 3.3e-3 .1e-1 .2e-2 .3e-3 1.e-1 2.e-2 3.e-3 1e-1 2e-2 3e-3)", R"(inf -inf nan)", }) { std::vector<Coord> coords; if (parse(begin(input), end(input), file_, coords)) fmt::print("Parsed:\n - {}\n", fmt::join(coords, "\n - ")); else fmt::print("Failed to parse\n"); } } This prints (live on coliru as well): Parsed: - (1.1, 2.2, 3.3) - (0.1, 0.2, 0.3) - (1, 2, 3) - (1, 2, 3) Parsed: - (-1.1, -2.2, -3.3) - (-0.1, -0.2, -0.3) - (-1, -2, -3) - (-1, -2, -3) Parsed: - (11, 220, 3300) - (1, 20, 300) - (10, 200, 3000) - (10, 200, 3000) Parsed: - (0.11, 0.022, 0.0033) - (0.01, 0.002, 0.0003) - (0.1, 0.02, 0.003) - (0.1, 0.02, 0.003) Parsed: - (inf, -inf, nan) > In summary, might Spirit, either v2 or v3, possibly work there? I do not expect the rules, synthesis, etc, to be that complex. It will be trickier, perhaps, to message a listener from the parser, but not insurmountable, I think. > > Thoughts? Note that X3 is not yet interface stable, so you might want to prefer Qi: https://coliru.stacked-crooked.com/a/1bdbbc130ffba345 Please don't use SWIG unless you are wrapping an API for use in other languages like Python or Matlab. Regards, Seth |
|
From: Michael P. <mwp...@gm...> - 2024-06-28 15:57:12
|
Hello, It's been a minute since I last explored Boost, Spirit, v3, etc, and I have a tiny project for which I am interested to consider Spirit, maybe v3, as one possible solution. Downloading the latest Boost 1.85 for starters, and will dev against that, for now; unless there is a better, considered more stable version. Apologies for the digest here, but there are some nuances I should outline approaching the question: might Boost Spirit, v2 or v3, possibly be able to help, I'm uncertain. Highlighting key considerations: - dotnet runtimes are the goal, decimal coordinates are a must for precision reasons, literally to the centimeter measurements, including fraction parts. - Regex, antlr4 prototypes are under consideration; regex currently with the lead in that race, antlr4 having some problems recognizing decimal numerics. - Spirit based approach would start from C++ and adapt either into C++ to C# SWIG, or perhaps just land directly in a Visual C++ CLR project. - Other nuances including anticipated coordinate input stream formats and such, inclusion of axis identification, etc. In a bit more depth: Currently, mentioned below, I have been experimenting with an Antlr4 based approach, but have been running into some difficulties with numeric recognition, especially in the anticipated use cases. Ultimately I need some 3D (dotnet) decimal (not float, definitely not double) coordinates to be parsed, or at least made possible via C++ Interop SWIG or C++ CLR. One key thing I should mention, the following forms should be doable, if possible. I can tailor tests one way or another, if necessary, but this is the aim, i.e. decimal coordinates, positive, and negative versions should also be supported: "1.2", ".2", "1.", "1". This is very key, although C++ float is probably my only choice there, I do not know. Precision is an absolute must, floating point precision issues cannot be tolerated. These are ultimately decimal coordinates in a 3D user space, the dimensions are precise centimeters, so floating point errors cannot be tolerated. Maybe float is best, double I think is straight out. Unless perhaps there is a C++ CLR decimal equivalent I can consider. One version of a parser is just the numbers in sequence, space delimited, very easy I suspect, even with crude (or more sophisticated) whitespace skippers, i.e. along these lines. "# # #", oversimplified of course and the use cases are a bit more involved than that. The next version is slightly more involved, 3D coordinate pairs, i.e. "X=# Y=# Z=#", along these lines. In the first version, coordinate identification should be positional in nature. In this version, of course, I may produce an axis enum based coordinate identification. Internally, I think it might be best to have internal productions synthesizing a C++ DSL along these lines. And provide a listener strategy coordinating, perhaps with C++ boost signals indicating when certain rules have been triggered. At least that's the thought right now; not married to it, unless anyone has a better suggestion off the cuff. My aim is to either package the parser and SWIG it into C#, if at all possible. Does not need to be fancy SWIG, but there are a couple of architecturally established interfaces, abstract classes, along these lines, which I would be extending. But I think the integration can be somewhat contained, so the conventions do not necessarily need to align that way, at least based on my Antlr4 results. Or, failing SWIG, if it is even possible to think about it, jumping directly into a Visual C++ CLR style project. In summary, might Spirit, either v2 or v3, possibly work there? I do not expect the rules, synthesis, etc, to be that complex. It will be trickier, perhaps, to message a listener from the parser, but not insurmountable, I think. Thoughts? Cheers, best, Michael W. Powell Some possibly useful links: https://learn.microsoft.com/en-us/dotnet/api/system.decimal https://swig.org https://www.boost.org/users/history/version_1_85_0.html https://www.boost.org/doc/libs/1_85_0/libs/spirit/repository/doc/html/index.html https://www.boost.org/doc/libs/1_85_0/libs/spirit/doc/html/index.html |
|
From: Seth <bu...@se...> - 2023-10-01 18:56:01
|
On Sun, Oct 1, 2023, at 5:44 PM, Raymond Burkholder wrote: > But I'll answer here anyway. The stakeholder is probably missing some important capabilities of ASIO. it can act in sync/async modes. In can act as a gateway. ASIO can reuse buffers. ASIO can work to reduce the number of copies made. 100% this. In fact, they also invented some limitations/specializations that are notoriously absent from the library. In fact it can be quite daunting to implement a request handling server in plain Asio (which is why e.g. Boost Beast exists). >> A. Is it correct my assumption that: each and every networking solution that can be implemented in C language can also be implemented in C++, using Boost.Asio? For some value of true, this is always true. Only, at some point you're effectively not using Asio anymore. But you can mix and match, so if you need e.g. lowlevel native access at some point, you can. Notable areas to be wary of is: raw sockets (supported, but harder), rare protocols (TCP/UDP are well facilitated, ICMP and similar can be done with little effort https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/overview/networking/protocols.html, everything else might require substantial extension work https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/overview/networking/other_protocols.html) >> B. Or, is it correct my assumption that synchronous implementations might be out of scope of Boost.Asio? They are not. But I'll add that it really sounds like you *absolutely* want/need aynchronous operation. Otherwise, you would basically have to resort to thread-per-connection model which just scales badly. >> C. If question A. is correct, then, is it possible to use Boost.Asio for a dedicated networking synchronous architecture and implementation where the Operating System is just a gateway (as described in the quoted email)? The wording "the OS is just a gateway" indicates sloppy specification or even confusion to me. The OS is always just an intermediary. The point seems to rather be that your application is merely a (monitoring?) gateway. Of course it possible, and indeed, quite easy and elegant to implement this with ASIO. With some proper configuration you would even benefit from io_uring if targeting kernel 5.10+: https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/overview/implementation.html#boost_asio.overview.implementation.linux_kernel_5_10 >> D. Or the suggested opinion of the quoted stakeholder is correct? It's hard to say - it does sound like some aspects are not fully informed. >> E. In case the quoted stakeholder is not correct on his assumption, do we have enough available documentation about Boost.Asio to implement a solution with the main topics described in question C.? How much documentation is required will largely depend on how much experience with networking code is present - specifically on the target platform >> F. Or, in case the quoted stakeholder is correct on his assumption: are you aware of an advisible library on top of which I might be able to develop the requested solution using modern C++, to avoid relying on a C solution? I don't. To be honest, it feels like any other library will receive the same scepsis from the client's reviewers: it's simply not "how they've always done things" so they will be hesitant. That's just my read - obviously you have been in actual contact with the reviewing engineers so should be in a better position to gauge the situation. >> >> In advance, I appreciate very much your answers, help, and precise advice! Just to highlight things missing from the picture: - this is not an ASIO mailing list. The most actively Asio support channels are cppslack https://cppalliance.org/slack/ - ironically most library experts lurk in the #beast channel. There's also an #asio channel (which might not be public, I don't remember) where Chris Kohlhoff is known to sometimes contribute - you don't describe the functionality of the application, though it seems a bit like you're building a pack-inspecting application proxy. It might even need to be a completely transparent network proxy? Be sure to ascertain which protocols must be supported (see also above), what QoI metrics are to be met. - thinking out of the box, if it's merely inspecting traffic flows, consider building it on iptables/BPF. You can even mock things up with tcpdump-like monitoring tools (or libpcap and friends in your custom code) My $0.02 Seth |
|
From: Raymond B. <ra...@on...> - 2023-10-01 16:09:15
|
I don't think the Spirit mailing list is the correct place for this message. The Boost Developer's list or Boost General list <boo...@li...> , or the live Slack forums are probably more appropriate. But I'll answer here anyway. The stakeholder is probably missing some important capabilities of ASIO. it can act in sync/async modes. In can act as a gateway. ASIO can reuse buffers. ASIO can work to reduce the number of copies made. It may be an issue of premature optimization to start worrying about how may many times copies are made. it may be more useful to quickly prototype something with ASIO so that you can get a grip on where the hot paths are, and then optimize from there. DPI more CPU intensive and latency prone than are some of the other operations you are discussing. The one thread per packet isn't the model. ASIO works with a worker thread model. So you can optimize the number of work threads depending on packet processing and how you want to group them. In addition, if you really want to get into the guts of packet delivery, then you probably want to consider the integration of eBPF into your overall workflow (where processing can be handled in the kernel, without context switching). And then, if you get into higher delivery rates, you may want to deal with packet processing offload into the NIC hardware, ... ie spread load across hardware, kernel, and app. If you want to bypass kernel processing, then look at DPDK which handles packets totally in user space. There are many other combinations of packet processing, all dependent on how something is going to be priced and how much hardware you can throw at the problem. On 9/30/23 04:34, Pablo Esteban Camacho wrote: > *[Boost.Asio] suggested to not be useful for a dedicated networking > synchronous implementation where the Operating System is just a gateway* > > Dear Sirs: > 1. I am a C++ Developer. Neither a Boost.Asio developer expert, nor a > networking expert. > 2. I have now the opportunity to develop a networking application from > scratch, which requires interaction with an already existing application. > 3. The already existing application seems to have been developed > entirely in C language, with Linux-based networking header files > (source code is not yet available to me). > 4. My first understanding (or, more precisely, my assumption) is that > each and every networking solution that can be implemented in C > language can also be implemented in C++, using Boost.Asio. > 5. However, reviewing again the Boost.Asio documentation, I am prone > to understand that "Asio" might be an acronym for: "ASinchronous > Input-Output". If this is correct, maybe, synchronous implementations > might be out of the scope of Boost.Asio. > 6. Since the application I have to develop needs to interact with an > already existing application, I also need to discuss my solution with > external stakeholders who are experts on that already existing > application. > 7. Now, even though I have the entire decision to choose the > development tools for this new application (my managers are > "networking" architects; not software architects; so, they rely > entirely on my own decision), I need to provide a precise fundament > for my election. > 8. Starting on my assumption posted in # 4, I want to develop a modern > C++ networking robust application, using Boost.Asio and rejecting a C > solution, if possible; of course. > 9. As my managers are not software experts, they are not able to > provide precise business requirements to me, valuable to making the > correct decision. > 10. Instead, to know even the business requirements of the new > application, it seems that I need to rely on the external stakeholders > (mentioned in # 6). > 11. I presented my intention of using Boost.Asio to one of those > external stakeholders and received the following response from him: > > > About using Boost.Asio library: > > 1) Following our meeting, I did a quick dive into the documentation > provided on > https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/overview.html. > > 2) I don’t have really some experience with Boost; but it seems to > me that the networking part of this library [Boost.Asio] is fully > oriented towards building an application server, i.e. allowing > agents/clients to connect to the machine running Boost.Asio and > allowing the program to process a result in an asynchronous way, and > then return a result (e.g. by responding to the same network socket). > Boost.Asio might be useful to build e.g. an HTTP server or a REST API > server. > > 3) Boost.Asio seems to rely on the networking capabilities of the OS > ["operating system"] (e.g. Sockets) to get the data from the received > packets, manage TCP connections handshakes, opening, and closing > (which implies packet copy between kernel land and user land, > impairing global performance). > > 4) In those cases, Boost.Asio seems to manage communications from a > client and intended for the server running the program. > > 5) Instead, the application you want to build is actually quite > different from that behaviour, as the machine will not be the > “destination” of those packets, but just a gateway. That means that > the packets received on the NIC ["network interface controller"] shall > not be fully interpreted by the OS, since the OS is not the recipient > of the packet. > > 6) Moreover, you cannot start an asynchronous operation per packet > found on the wire, as this will overload the system. > > 7) So the "packet acquisition" / "thread dispatching" for the > traffic management of your application seems actually not be > manageable by Boost.Asio library. > > 8) As a consequence, my view is that you will have to manage the > "packet acquisition" / "thread dispatching" / "per thread packet > processing" in a dedicated synchronous architecture (as built in our > code samples). And then, the result of the DPI ["deep packet > inspection"] analysis can be a "starting point event" (or allow to > launch an "initiating function") for further asynchronous mechanism > run by Boost.Asio to perform operations based on DPI results (and > containing the specific logic of your application). > > 9) As indicated in the beginning, I’m not a Boost.Asio expert, so > please tell me if my understanding is wrong. > > 12. First of all, I want to clarify that I arrived to know all the > content of the quoted email via that email and not before. That is: > even the requirements of the "dedicated synchronous architecture" were > provided to me in that email, "as if I was aware of them before that > email". > 13. Now, as you can understand, I cannot start a long development path > ending at the middle of it saying: "We made a wrong assumption. We > cannot use Boost.Asio. We need to turn back on our own steps and start > all over again with a different approach". This would be unacceptable. > 14. And it would be more unacceptable with the previous quoted email > coming from a person that, even he is not a Boost.Asio expert, he is > an expert on his own already existing application and seems to be the > referent, so far, for my own requirements. > 15. Even though we are at a very early stage (where I have not even > access to the existing source code, as mentioned), a response on this > topic is expected from my side. > 16. Consequently, given the corresponding context, I am presenting now > my questions: > > A. Is it correct my assumption that: each and every networking > solution that can be implemented in C language can also be implemented > in C++, using Boost.Asio? > B. Or, is it correct my assumption that synchronous implementations > might be out of scope of Boost.Asio? > C. If question A. is correct, then, is it possible to use Boost.Asio > for a dedicated networking synchronous architecture and implementation > where the Operating System is just a gateway (as described in the > quoted email)? > D. Or the suggested opinion of the quoted stakeholder is correct? > E. In case the quoted stakeholder is not correct on his assumption, do > we have enough available documentation about Boost.Asio to implement a > solution with the main topics described in question C.? > F. Or, in case the quoted stakeholder is correct on his assumption: > are you aware of an advisible library on top of which I might be able > to develop the requested solution using modern C++, to avoid relying > on a C solution? > > In advance, I appreciate very much your answers, help, and precise advice! > > > Pablo Esteban Camacho > C & C++ Developer > pab...@gm... > pab...@ya... > https://www.linkedin.com/in/pablo-esteban-camacho/ > > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general |
|
From: Pablo E. C. <pab...@gm...> - 2023-09-30 10:35:16
|
*[Boost.Asio] suggested to not be useful for a dedicated networking synchronous implementation where the Operating System is just a gateway* Dear Sirs: 1. I am a C++ Developer. Neither a Boost.Asio developer expert, nor a networking expert. 2. I have now the opportunity to develop a networking application from scratch, which requires interaction with an already existing application. 3. The already existing application seems to have been developed entirely in C language, with Linux-based networking header files (source code is not yet available to me). 4. My first understanding (or, more precisely, my assumption) is that each and every networking solution that can be implemented in C language can also be implemented in C++, using Boost.Asio. 5. However, reviewing again the Boost.Asio documentation, I am prone to understand that "Asio" might be an acronym for: "ASinchronous Input-Output". If this is correct, maybe, synchronous implementations might be out of the scope of Boost.Asio. 6. Since the application I have to develop needs to interact with an already existing application, I also need to discuss my solution with external stakeholders who are experts on that already existing application. 7. Now, even though I have the entire decision to choose the development tools for this new application (my managers are "networking" architects; not software architects; so, they rely entirely on my own decision), I need to provide a precise fundament for my election. 8. Starting on my assumption posted in # 4, I want to develop a modern C++ networking robust application, using Boost.Asio and rejecting a C solution, if possible; of course. 9. As my managers are not software experts, they are not able to provide precise business requirements to me, valuable to making the correct decision. 10. Instead, to know even the business requirements of the new application, it seems that I need to rely on the external stakeholders (mentioned in # 6). 11. I presented my intention of using Boost.Asio to one of those external stakeholders and received the following response from him: > About using Boost.Asio library: > 1) Following our meeting, I did a quick dive into the documentation provided on https://www.boost.org/doc/libs/1_83_0/doc/html/boost_asio/overview.html. > 2) I don’t have really some experience with Boost; but it seems to me that the networking part of this library [Boost.Asio] is fully oriented towards building an application server, i.e. allowing agents/clients to connect to the machine running Boost.Asio and allowing the program to process a result in an asynchronous way, and then return a result (e.g. by responding to the same network socket). Boost.Asio might be useful to build e.g. an HTTP server or a REST API server. > 3) Boost.Asio seems to rely on the networking capabilities of the OS ["operating system"] (e.g. Sockets) to get the data from the received packets, manage TCP connections handshakes, opening, and closing (which implies packet copy between kernel land and user land, impairing global performance). > 4) In those cases, Boost.Asio seems to manage communications from a client and intended for the server running the program. > 5) Instead, the application you want to build is actually quite different from that behaviour, as the machine will not be the “destination” of those packets, but just a gateway. That means that the packets received on the NIC ["network interface controller"] shall not be fully interpreted by the OS, since the OS is not the recipient of the packet. > 6) Moreover, you cannot start an asynchronous operation per packet found on the wire, as this will overload the system. > 7) So the "packet acquisition" / "thread dispatching" for the traffic management of your application seems actually not be manageable by Boost.Asio library. > 8) As a consequence, my view is that you will have to manage the "packet acquisition" / "thread dispatching" / "per thread packet processing" in a dedicated synchronous architecture (as built in our code samples). And then, the result of the DPI ["deep packet inspection"] analysis can be a "starting point event" (or allow to launch an "initiating function") for further asynchronous mechanism run by Boost.Asio to perform operations based on DPI results (and containing the specific logic of your application). > 9) As indicated in the beginning, I’m not a Boost.Asio expert, so please tell me if my understanding is wrong. 12. First of all, I want to clarify that I arrived to know all the content of the quoted email via that email and not before. That is: even the requirements of the "dedicated synchronous architecture" were provided to me in that email, "as if I was aware of them before that email". 13. Now, as you can understand, I cannot start a long development path ending at the middle of it saying: "We made a wrong assumption. We cannot use Boost.Asio. We need to turn back on our own steps and start all over again with a different approach". This would be unacceptable. 14. And it would be more unacceptable with the previous quoted email coming from a person that, even he is not a Boost.Asio expert, he is an expert on his own already existing application and seems to be the referent, so far, for my own requirements. 15. Even though we are at a very early stage (where I have not even access to the existing source code, as mentioned), a response on this topic is expected from my side. 16. Consequently, given the corresponding context, I am presenting now my questions: A. Is it correct my assumption that: each and every networking solution that can be implemented in C language can also be implemented in C++, using Boost.Asio? B. Or, is it correct my assumption that synchronous implementations might be out of scope of Boost.Asio? C. If question A. is correct, then, is it possible to use Boost.Asio for a dedicated networking synchronous architecture and implementation where the Operating System is just a gateway (as described in the quoted email)? D. Or the suggested opinion of the quoted stakeholder is correct? E. In case the quoted stakeholder is not correct on his assumption, do we have enough available documentation about Boost.Asio to implement a solution with the main topics described in question C.? F. Or, in case the quoted stakeholder is correct on his assumption: are you aware of an advisible library on top of which I might be able to develop the requested solution using modern C++, to avoid relying on a C solution? In advance, I appreciate very much your answers, help, and precise advice! Pablo Esteban Camacho C & C++ Developer pab...@gm... pab...@ya... https://www.linkedin.com/in/pablo-esteban-camacho/ |
|
From: Richard <leg...@xm...> - 2023-09-17 22:56:35
|
In article <62c...@gm...> you write: >That is wonderful! That is a nice presentation. Thanks! I try to present from real code in the IDE as much as possible so that we're looking at real code. I almost always write my own examples with the library I'm presenting and put them on github. The exception is when the library comes with an example that is everything I want to talk about :). I cribbed quite a bit from the spirit x3 fun example presented by Michael Caisse a few years back, but I did extend the AST to handle imaginary numbers. Which reminds me I need to file a bug report on that doc issue I encountered. -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
|
From: Joel de G. <dj...@gm...> - 2023-09-17 22:09:59
|
HI Richard, That is wonderful! That is a nice presentation. Regards, --Joel On 9/18/23 3:53 AM, Richard wrote: > In article <5f0...@ap...> you write: > >> Good luck with the presentation, and have fun! >> Seth > The presentation went well, but as always with a large surface area > library like Spirit it went on for too long IMO (2 hrs). This was > similar to what happened when I presented Spirit 2.x almost 10 yrs > ago. If I were to present on this again, I would split the topic into > two talks: > > 1) A background on recursive variant datatypes and visitor pattern and > dipping into the Fusion library for adapting arbitrary application > structures to Fusion tuples. > > 2) Spirit X3 parsing w/annotations and error handling. > > Still, even though the talk brushed up against my hard limit for talk > length (2 hrs), I thought it went well. The video is here: > <https://www.youtube.com/watch?v=9QlPOYX8mgw> > -- > "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> > The Terminals Wiki <http://terminals-wiki.org> > The Computer Graphics Museum <http://computergraphicsmuseum.org> > Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> > > > _______________________________________________ > Spirit-general mailing list > Spi...@li... > https://lists.sourceforge.net/lists/listinfo/spirit-general -- Joel |
|
From: Richard <leg...@xm...> - 2023-09-17 19:54:17
|
In article <5f0...@ap...> you write: >Good luck with the presentation, and have fun! >Seth The presentation went well, but as always with a large surface area library like Spirit it went on for too long IMO (2 hrs). This was similar to what happened when I presented Spirit 2.x almost 10 yrs ago. If I were to present on this again, I would split the topic into two talks: 1) A background on recursive variant datatypes and visitor pattern and dipping into the Fusion library for adapting arbitrary application structures to Fusion tuples. 2) Spirit X3 parsing w/annotations and error handling. Still, even though the talk brushed up against my hard limit for talk length (2 hrs), I thought it went well. The video is here: <https://www.youtube.com/watch?v=9QlPOYX8mgw> -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://computergraphicsmuseum.org> Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com> |
|
From: Seth <bu...@se...> - 2023-09-03 02:31:10
|
On Wed, Aug 30, 2023, at 5:48 AM, Richard wrote: > Hi, > > So the symbols parser is an example of a dynamic parser in X3. I am trying to > write a parser for a GIF image file. A GIF file is a series of chunks. Chunks > are prefixed with a length indicating the number of bytes in the chunk. Many > binary formats have the length of a binary block encoded in the stream followed > by <length> bytes (or words or whatever unit) representing the block. > > How do we parse this using X3 spirit? I did a dynamic repeat parser back when: https://stackoverflow.com/questions/33624149/boost-spirit-x3-cannot-compile-repeat-directive-with-variable-factor/33627991#33627991 > > Do we use a success handler for the length to record it in the context and then > somehow use a repeat parser that grabs the repeat count from the context? > What, exactly, does that look like? That's a variation. In reality, I'd probably make a parser type - I think it was discussed in the comments there too https://stackoverflow.com/questions/33624149/boost-spirit-x3-cannot-compile-repeat-directive-with-variable-factor/33627991#comment55039410_33624149 > > I'm hoping to figure this out in time for a presentation on X3 to Utah C++ > Programmers on Sept. 13th. Apropos of nothing, there's a building block to get /anything/ lazily parsed: https://stackoverflow.com/questions/60171119/boost-spirit-x3-lazy-parser/60176802#60176802 Good luck with the presentation, and have fun! Seth |
|
From: Richard <leg...@xm...> - 2023-08-30 03:48:55
|
Hi, So the symbols parser is an example of a dynamic parser in X3. I am trying to write a parser for a GIF image file. A GIF file is a series of chunks. Chunks are prefixed with a length indicating the number of bytes in the chunk. Many binary formats have the length of a binary block encoded in the stream followed by <length> bytes (or words or whatever unit) representing the block. How do we parse this using X3 spirit? Do we use a success handler for the length to record it in the context and then somehow use a repeat parser that grabs the repeat count from the context? What, exactly, does that look like? I'm hoping to figure this out in time for a presentation on X3 to Utah C++ Programmers on Sept. 13th. Thanks, -- Richard -- "The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline> The Terminals Wiki <http://terminals-wiki.org> The Computer Graphics Museum <http://ComputerGraphicsMuseum.org> Legalize Adulthood! (my blog) <http://LegalizeAdulthood.wordpress.com> |
|
From: Seth <bu...@se...> - 2023-04-06 14:21:05
|
It's by design, likely to make it efficient and easy (without surprises!) to use symbols in parser expressions. In effect, they get "reference semantics" just like `qi::rule<>` does when embedded in other rules.
You can easily deep-clone a symbol table if you need:
template <typename Sym> Sym clone_syms(Sym const& i) {
Sym o;
i.for_each(o.add);
return o;
}
Here's a live demo driving home the points with more examples: http://coliru.stacked-crooked.com/a/263d22bc47d63375
On Mon, Apr 3, 2023, at 10:50 PM, James Walker wrote:
> If I run code like this
>
> boost::spirit::qi::symbols<char, double> syms1;
> boost::spirit::qi::symbols<char, double> syms2( syms1 );
> syms1.at("x") = 0.0;
> syms2.at("x") = 99.5;
> std::cout << "In syms1, x=" << syms1.at("x") <<
> " while in syms2, x=" << syms2.at("x") << std::endl;
>
> I get the output "In syms1, x=99.5 while in syms2, x=99.5". Why didn't
> x stay at 0.0 in syms1?
>
> _______________________________________________
> Spirit-general mailing list
> Spi...@li...
> https://lists.sourceforge.net/lists/listinfo/spirit-general
|
|
From: James W. <li...@jw...> - 2023-04-03 21:08:02
|
If I run code like this
boost::spirit::qi::symbols<char, double> syms1;
boost::spirit::qi::symbols<char, double> syms2( syms1 );
syms1.at("x") = 0.0;
syms2.at("x") = 99.5;
std::cout << "In syms1, x=" << syms1.at("x") <<
" while in syms2, x=" << syms2.at("x") << std::endl;
I get the output "In syms1, x=99.5 while in syms2, x=99.5". Why didn't x stay at 0.0 in syms1?
|