3 ms·
I used Boost Spirit in my dissertation project for the parsing: https://github.com/scotts/cellgen/blob/master/src/cellgen_grammar.cpp#L289 https://github.com/sc
by scott_s 16y ago
I used Boost Spirit in my dissertation project for the parsing: https://github.com/scotts/cellgen/blob/master/src/cellgen_grammar.cpp#L289 https://github.com/scotts/cellgen/blob/master/src/cellgen_gr...
I would not choose it again. With what I wanted to do, the performance was poor. Spirit just had to deep-copy the parse tree it was generating way too much. I liked having all of my source in C++, which meant not having to embed C++ in ANTLR or yacc. But I'm not sure that was worth it. Perhaps the newer version fixes that problem, but I doubt I'll ever test it out for sure.
Luckily for me, the performance of the compiler itself was not really a priority. And it was a research project, so it didn't really matter.
Anyway, I know your point was broader than Spirit specifically, but I thought you may be interested in my experiences.
- munificent 16y agoIs there a reason you didn't just handcode a recursive descent parser?
- scott_s 16y agoYes. It's a waste of time. Why should I hand-code a parser for C when it's a solved problem? Note that the source code I linked to calls into an already existing Spirit grammar for C (which I made some modifications to, mainly so I could get more information back from the parse tree). Hand coding a parser is generally not a good use of your time. There are many tools available to generate a parser based on a BNF grammar. I used my project as an opportunity to learn one of them.