"Aaron Griffin"
On 9/29/05, Joel de Guzman
wrote: Aaron Griffin wrote:
Spirit seems good, but it seems very weighty to work with.
Spirit-2 (core) will fix this impression. I'm working on it. It would help a lot if you add few sentences why you think Spirit "seems very weighty".
As for my "weighty" impression - it has nothing to do with actual functionality or anything, as I haven't actually finished/tested anything beyond a proof-of-concept.
Now don't get me wrong. I'm not saying this is bad or anything. It may just be the way I design things (yeah, in a bit more of a C way). I can't really propose anything, except that some generic generator functions might make things intersting... for instance, something like: rule<> something = '_' >> range('a','z') >> '_'; rule<> another = ('(' | '[') >> something >> (']' | ')'); parse(start,end, make_grammar(/*start rule*/ something, /*the rest*/ another); );
If I could generate a full parser for something simple in that fashion, that'd be great. Now, I'm not saying the class thing is bad. But for, say, parsing a url or something small, the tradeoff is small.
Aah, but spirit already does that: parse ( lRtmData.Begin() , lRtmData.End () , *( ( str_p("Altia*AltiaScene*background:") >> '#' >> hex_p[assign(mBackGroundColor)] ) | ( str_p("Altia*AltiaScene*width:" ) >> uint_p[assign(mWindowSize.cx )] ) | ( str_p("Altia*AltiaScene*height:" ) >> uint_p[assign(mWindowSize.cy )] ) | anychar_p ) , space_p ); Just create your grammar in place. In my case I'm assigning to some member variables. I use spirit in this fashion in dozens of places in my applications. Jeff Flinn