On 9/28/05, Simon Buchan
Aaron Griffin wrote:
Ok, I didn't go to school for computer programming, so I never had experience with a "Compilers" class or anything related to lexing/parsing. But now I'm getting interested in it and have begun looking at some things.
Spirit seems good, but it seems very weighty to work with.
I was wondering if anyone has experiences with Spirit *and* CTTL and would be able to list for me some of the pros and cons of each. Spirit is, of course, a boost library and would be easier to find help and things of that nature, but CTTL seems to be a tad more lightweight (I'm not really sure).
Thanks for any and all replies.
Don't forget to put a link in: http://cttl.sourceforge.net/
Errrmmm... I could have *sworn* I put that link in there....
From what I've seen, this is MUCH harder to write grammars in, but that's probably just because i'm not used to it. Compare:
Echo's back a Java/C++ program without it's comments: http://cttl.sourceforge.net/example_cpp_comment_strip_cpp.html Description of Spirit's comment matching facilities (amongst other uses), A file that demonstrates it is linked at the bottom. http://www.boost.org/libs/spirit/doc/confix.html
Hmmm, I see now. Of course, you have to ignore all the extraneous stuff in the CTTL example... and semantic actions and things like that. I actually started messing with both spirit and cttl on a similar parser (contrived syntax) and while the spirit one is much easier to write, there's syntactic things that bother me (+ would have been better than >> for sequence operator, overloading [] for semantic actions seems awfully arbitrary, and the requirement for my_grammar::definition seems unnessecary), but I guess that's what I'll have to live with, eh?