Hacker News new | past | comments | ask | show | jobs | submit login


That's the algorithm for the common lisp reader. Writing a recursive descent parser based on that spec is fairly straightforward.

And once you hand write your own recursive descent parser you'll probably not want to give up the control that gives you to a parser generator. Yuck.

I was playing with a parser generator last summer, and it was immensely frustrating to bump into bugs it had & features it lacked. In the end, it was much easier easier to write the entire parser myself. So if I understand the point you're making, I agree that giving up control can suck!

You should check out parser combinators. I've also used parser generators in the past and experienced similar frustrations. Parser combinators are just so much easier to use.

Hey, I saw your comment on ketamine but couldn't reply. Are you still taking it?

And then you will write a parser generator with Parsec and you will not want to give up the ease compared to writing your own recursive descent parser :)

Yeah, parser combinators are basically magic, and not in an “overly clever code that you’ll regret later” sense.

And, while a Haskell-style type system makes them nicer, they work really well in dynamically typed languages too. (e.g. https://github.com/drewc/smug )

I'd love a good parser generator to save me writing recursive descent ones roughly annually in my career, but the ones I've encountered are awful.

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