4 ms·
Parser generators. They get better and easier to use every year (PEGs being the newest kid on the street), but we still see loads of buggy ad-hoc parsers with l
by vog 9y ago
Parser generators. They get better and easier to use every year (PEGs being the newest kid on the street), but we still see loads of buggy ad-hoc parsers with loops and regexes. And many of those bugs turn into actual security issues.
- Jeff_Brown 9y agoYes, these are great! Text.Megaparsec.Expr blew my mind. It lets you write something that can evaluate expressions like "(3 + 4/(-2)) * 7" -- a nested expression parser, with prefix, postfix and infix operators of varying associativity and precedence -- in 12 lines of code. I made a repo about it [here](https://github.com/JeffreyBenjaminBrown/megaparsec/tree/master/Expr-studies https://github.com/JeffreyBenjaminBrown/megaparsec/tree/mast...).