3 ms·
You won't find me defending the use of yacc, but in general hand written parsers are far more error prone.
by jasonwatkinspdx 5y ago
You won't find me defending the use of yacc, but in general hand written parsers are far more error prone.
- dbcurtis 5y agoMy strategy when faced with doing a DSL of some kind is to write an accepter in bison or similar and knock the bugs out of the grammar and basic readability issues. Then go recursive descent with a table-driven precedence-climbing parser for expressions when ready for the real deal.
- kqr 5y agoThis is, I think, a very good strategy for many reasons. Not only is it a cheap way to work out tthe design of the language and a way to verify the correctness of your implementation. It's also a good fallback solution: if your (more expensive, expressive) implementation is not ready in time, you can fall back to integrating the generated implementation to meet an important deadline or whatnot.