3 ms·
You are focusing on the wrong things. If you want to treat it like a compiler there are better simpler more suited for performance ways to do it, i.e. making a
by zzzcpan 8y ago
You are focusing on the wrong things. If you want to treat it like a compiler there are better simpler more suited for performance ways to do it, i.e. making a DSL and a parser generator. And it can and often will be more flexible and easier to deal with, than your idea.
But none of this is still flexible enough and simple enough, not as much as a hand written recursive descent parser. Say you are just starting out, such hand written parser is the easiest way to get into parsing. It gets old rather quickly though, a bigger parser becomes harder to change and to reason about. But until you figure out exactly what to parse and what level of performance you need, it's still better to keep all that flexibility and simplicity. And this is where this simple idea of composable higher order recursive descent parsers starts to shine. It keeps all the flexibility and improves on parsing simplicity by sacrificing just a little bit of simplicity locally in rather simple parsing function primitives, where it's not even noticeably harder to reason about.
- naasking 8y agoDSL compilers with separate parsers, assemblers and tooling are emphatically not simpler than an EDSL. The rest of your post seems unrelated to anything I've mentioned. Clearly you and I are talking about completely different things. I again suggest you read the link I provided, but it doesn't seem fruitful to continue this thread any further.