Serving the Quantitative Finance Community

 
User avatar
axsaxs
Posts: 1
Joined: January 4th, 2008, 12:19 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 3rd, 2010, 8:31 pm

wouldn't that be slower than just getting the bytes
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 4th, 2010, 7:12 am

You could use Spirit (Spirit2?) but would it be the most suitable? There are other, more low-entry options in boost:. StringAlgo (is useful but stops at strings, bit of regex). Regex can define regular expressions (e.g. your (a|b|c)* ) and then match/search/replace . Xpressive (REs and the ensuing semantic actions and user-defined assertions). Easy learning curve.It depends on what the problem is. edit: bojan has some remarks on Xpressive and its applicability to order book flow.
Last edited by Cuchulainn on April 3rd, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 4th, 2010, 10:19 am

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnYou could use Spirit (Spirit2?) but would it be the most suitable? There are other, more low-entry options in boost:. StringAlgo (is useful but stops at strings, bit of regex). Regex can define regular expressions (e.g. your (a|b|c)* ) and then match/search/replace . Xpressive (REs and the ensuing semantic actions and user-defined assertions). Easy learning curve.It depends on what the problem is. edit: bojan has some remarks on Xpressive and its applicability to order book flow.good edit!the messages look like this:10=3.14;11=hi;45=what?;80=1234;i.r.key=value;key=value;...the key is always an integer the value type dependent on the key (int, string, float)I'm now thinking on writing a simple state transition loop that extract key,value pairs and calls some function with thoseI knocked up a quick piece of code to do the k/v part of this stuff (the niceties of RTTI is student exercise, maybe boost any or Variant..)
Last edited by Cuchulainn on April 3rd, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 4th, 2010, 12:07 pm

QuoteI'll compare performance against a simple alternating '=' and ';' scanner, thanks!Btw: map.insert(make_pair(k,v)) is faster than map[k]=vChances are that Xpressive is faster than any other hand-crafted solution. After all, that's what these guys do.How much faster?
Last edited by Cuchulainn on April 3rd, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
ktang
Posts: 0
Joined: January 15th, 2010, 7:16 pm

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 4th, 2010, 8:41 pm

Here is a solution with spirit stolen from Hartmut.Can you take this in your comparison ?
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 5th, 2010, 6:42 am

Here's the third option using the StringAlgo
Last edited by Cuchulainn on April 4th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 5th, 2010, 6:45 am

And here is the bare essentials (no print stuff): Corollary: StringAlgo is extremely useful.
Last edited by Cuchulainn on April 4th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 5th, 2010, 8:23 am

Solution #4: If you want to have more control over the precise form of the regular expressions in your order book, you can use Regex. Here is some code (we can talk about V2 over a coffee )
Last edited by Cuchulainn on April 4th, 2010, 10:00 pm, edited 1 time in total.
 
User avatar
Cuchulainn
Posts: 22928
Joined: July 16th, 2004, 7:38 am

Anyone using boost::spirit or flex for FIX parsing (or other protocols)

April 7th, 2010, 3:07 pm

dbl
Last edited by Cuchulainn on April 6th, 2010, 10:00 pm, edited 1 time in total.