|
|
|
|
|
by kerkeslager
323 days ago
|
|
> Those writing parsers are disproportionately writing things like programming languages and language servers that are quite complex. Sure, but adding the complexity of a parser generator doesn't help with that complexity in most cases. [General purpose] programming languages are a quintessential example. Yes, a compiler or an interpreter is a very complex program. But unless your programming language needs to be parsed in multiple languages, you definitely do not need to generate the parser in many languages like SQLite does. That just adds complexity for no reason. You can't just say "it's complex, therefore it needs a parser generator" if adding the parser generator doesn't address the complexity in any way. |
|
Creating abstractions does decrease complexity if one (or more) of the following is true:
- The abstraction generates savings in excess of it's own complexity
- The abstraction is shared by enough projects to amortize the cost of writing/maintaining it to a tolerable level
- There are additional benefits like validating your grammars are unambiguous or generating flow charts of your syntax in your documentation, amortizing the cost across different features of the same project
It's up to you as the implementer to weigh the benefits and costs. If you choose to use recursive descent, more power to you. (For what it's worth, I personally use parser combinators to split the difference between writing grammars and hand-rolling parsers. But I've used parser generators before and found them helpful.)