Staged Parser Combinators in Scala: Have Your Cake and Eat It (Too)

Parser combinators have a reputation of poor performance&mdash;worst-case exponential time&mdash;and deemed good for prototyping but not for production. Or so the story goes. While techniques like Packrat parsing or static analysis offer linear-time guarantees by addressing naive backtracking, they come with their own trade-offs. In this post, I want to explore an optimization route that…