Hacker News new | ask | show | jobs
by rco8786 3982 days ago
You should check out the Parser package in the scala standard lib. I maintain a few DSLs using this and it's an absolute dream.

https://wiki.scala-lang.org/display/SW/Parser+Combinators--G...

Code looks solid otherwise...at least where I work the style would be to favor functional idioms over for loops but I think that's just personal preference.

2 comments

That has been removed from the Scala standard lib and is now distributed separately. I am unsure how well it will be maintained by the community. As the other commenter said, parboiled2 is a good choice using macros and it is lightning fast. A lighter weight, runtime choice that was released recently is fastparse[0].

0 - https://github.com/lihaoyi/fastparse

Oh wow very good to know. We're just now looking to get to 2.11(very large codebase, upgrades are hard) so will definitely need to keep this in mind.
The Parboiled2 framework is often used for building parsers.