Re:Scala Considered Harmful For Large Projects?
by munificent on Thursday February 17, 2011 @04:36PM
(#2232974)
Is there a reason you didn't just handcode a recursive descent parser?
Re:Scala Considered Harmful For Large Projects?
by scott_s on Thursday February 17, 2011 @04:45PM
(#2233007)
Yes. 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.
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.