Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Shameless plug: Single-file Java Pratt expression parser library: https://github.com/stefanhaustein/expressionparser


One of the disadvantages they list is that recursive-descent parsers are harder to read than e.g. DSLs.

So the best of both worlds, it sounds to me, would be parser combinators: They're both native to the language, and they're DSLs. So there's only one set of syntax for the programmer, and they still compose declaratively as opposed to writing recursive parsers manually.


Personally, while I do find DSLs easier to read, I find writing them harder than recursive descent. The problem is that a DSL will still have theoretical limitations (ie shift shift or shift reduce errors, left recursion, performance). In order to deal with these limitations you still have to know how everything works under the hood.

With recursive descent, you can always start adding break points until you understand the forces involved.


Or maybe a Pratt parser dsl?

What I think is how provide a common parser layer yet allow to get the same benefits of a hand-made one. For some reason, this look like is impossible?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: