Lurker News

Comments (983) 199 threads

Show all comments

Showing thread 122 of 199

vog1 reply#
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#
Yes, 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/mast...).