|
Boost : |
Subject: Re: [boost] C++ Networking Library Release 0.5
From: Joel de Guzman (joel_at_[hidden])
Date: 2010-02-02 07:41:12
On 2/2/2010 5:43 PM, edouard_at_[hidden] wrote:
> lit("command1")>> +char_[ref(my_str) = _1]>> lit("separator")>>
> +char_[ref(my_str2) = _1] |
> lit("command2)>> +alnum_[ref(my_str) = _1]
>
> This is really cool and much easier to understand than the current loop.
> Currently the memory allocation occurs when putting the input into the
> string. I now realize I can replace ref(my_str) = _1 with something that's
> going to build a pair of pointers based on the input which should reduce
> the gap between Spirit and the custom parser.
>
> But then I encountered a different problem which is that the 'grammar'
> cannot be read from left to right. Basically the input may contain the
> separator, so what I currently do is read my command, start from the right,
> when I reach the separator I have my second token and the rest is the first
> token. That can be avoided as well in offloading this part off Spirit.
>
> Then again I want to insist I'm new to Spirit and just wanted to give it a
> shot and see if I could quickly leverage it. It is my current conclusion
> that for my specific problem MSM might be best suited, but then again I
> just wanted to allocate one day for this mini-benchmark and all I can say
> is that it will take more than one day to tell, day I don't have.
Understood. Well, if you have more time and want to give it another
shot, then we're here if you need help.
Regards,
-- Joel de Guzman http://www.boostpro.com http://spirit.sf.net http://www.facebook.com/djowel Meet me at BoostCon http://www.boostcon.com/home http://www.facebook.com/boostcon
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk