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

A few years back I had to implement a new parser for a custom expression language to replace an old parser that didn’t give very good errors and was hard to extend. I never did the traditional CS track so parsers were kind of mysterious black magic so naturally first thing I did was search HN.

I stumbled on an older parsing thread [1] with a link to a toy Pratt implementation [2] made by an HNer… and shamelessly ripped it off to write my own production Pratt parser implementation.

Great success! Writing a Pratt parser by hand is a lot easier than I thought and like the comment says, adding type information was trivial.

[1] https://news.ycombinator.com/item?id=24480504

[2] https://github.com/mx-scissortail/WebBS



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

Search: